A perfect-looking boot that fits all wrong is vastly inferior to an ugly boot that loves your feet. Basically, you want a boot that holds your foot but leaves your toes free. It should be tight enough that it won't rub blisters, with enough room in the toes that you won't destroy your toenails as you hike downhill.
First, consider snugness: In both width and volume, you want a boot that hugs your foot without squishing it. With that in mind, when trying on boots, be sure to wear the socks you plan to don during your hike. Then feel the width. If a boot is too wide, your foot will slide, and if it's too narrow, you'll eventually get foot cramps. Narrow brands include Sportiva and Merrell, and wider brands include New Balance and Asolo [source: Backpacker.com]. You'll also want to take into account that feet have a tendency to swell over the course of a long hike.
Then consider your toes. When you're hiking uphill, you don't have to worry as much about your toes. But when you're going downhill, if your boots are too short, your toes and nails will ram into the front of the boot, which may cause your toenails to turn black. When you're trying on boots at the store, be sure you can wiggle your toes in each pair. Then, unlace the boot and shove your toes to the front: There should be about a finger's width between your heel and the back of the boot [source: GreatOutdoors.com].
Please note that it's nearly impossible to buy the right boots for your feet online. You need to try on a pair of boots before you buy them. (And once you've spent a half-hour with a salesperson, you might as well buy them from him or her rather than online.)