It's length + width + height, add that together and the total should be less than the total allowed linear inches posted on your airlines website (not all airlines are the same, check yours!) Watch the length though, anything over about 22 inches and the overhead bin might not close, if that happens you may have to gate check your bag. If you have roller bags and the wheels extend out further than the bag, count the wheels in your measurement.
You do get some wiggle room on the size, they don't check that closely. As long as the bag isn't so long that it won't let the bin close (they want you to put the bag in so that the wheels are at the back of the bin and the handles are towards the door of the bin, they fit more bags that way) they usually don't look that closely. My bag was two inches over the limit (1 inch too high and one inch too wide) but because the lenght was okay, the bin closed and it worked out fine.
ETA: If you're really worried, you are allowed one personal item along with one carry on, the personal item can be just about anything as long as it can fit under the seat in front of you. This includes small overnight bags, backpacks, large purses, etc. You can pack valuable/fagile items in a small backpack/overnight bag and if you do have to check your bag because it's too big, you can still keep the valuable stuff with you on the flight.