Here's how to go about it.
Choose a full face helmet and not a "decorative" helmet. A "brain bucket" (looks like a soup bowl) or open face helmet will NOT provide the protection you need to keep everything where it should be.
The first step is to measure your head. Even if you think you know what size helmet you need, it's worthwhile to take the time to double-check. Get someone to help and a small measuring tape. Measure the circumference of your head from about one inch above your eyebrows in front to the point at the back of your head that gives you the largest measurement. Measure several times just to make sure you've got it. Now match the measurement with the helmet sizes on the chart provided by producers (check on wb-sites), rounding up to the next largest number if your measurement falls between sizes.
Next, it's time to try on a few helmets. Do not worry about colors and graphics yet, our first concern is finding the right fit. Grasp the helmet by the chin straps with the top of the helmet down and the front of the helmet facing you. Balance the helmet with your fingers, and slide your thumbs to the inside surface of the chin straps. Now spread the helmet apart and slip it over your head. You may need to tip it backward or forward a bit to help slip it on.
The helmet should go on with some resistance if it's in the proper size range. Unfortunately, most people tend to choose helmets that are too large, so if the helmet feels snug at first, you're probably close to the proper size. Do not reach for a larger size unless you can not get the helmet on at all. Now that you have the helmet on, go find a mirror for a quick visual check. The helmet should sit squarely on your head, neither tipped forward nor backward.
With a full-face helmet, your eyes should be centered in the opening with the padding of the liner fitting just above your eyebrows. While you're looking in the mirror, check for gaps between the padding and your head. The cheek and brow pads should be in firm contact with your face, without causing excessive pressure. Now put one hand on each side of the helmet and hold your head still while trying to rotate the helmet from side to side and front to back.
The helmet should not slide around on your head without a lot of resistance. In fact, your skin and scalp should move with the helmet. Remember that helmets will "break in" just like hats, so the helmet that's just right for you may feel overly-snug at first.
Note any pressure points or "hot spots." If the helmet fits properly, the pressure should be evenly distributed around your head. Make sure the chin strap is snugly fastened and try the "roll-off" test. Reach over the top of the helmet and grasp the bottom rear edge. Try to roll the helmet forward off your head while you hold your head as still as possible. Pull as hard as you can without causing yourself pain. If the helmet moves significantly or rolls off your head, it's too large.
Before you take the helmet off, think about pressure points again. Do there seem to be spots where the pressure is excessive? Remember pressure that may be only mildly irritating at first, can cause a raging headache after an hour in the saddle. Stay close to the mirror while you take the helmet off, then look for any areas of reddened skin that signal pressure points. If you find any, put the helmet back on and see if you feel extra pressure in the reddened area. When you think you've found the perfect fit, try on the same make and model of helmet in the next larger and smaller sizes, going through all the same tests.
Before you make the final decision, put the helmet back on and wear it for at least ten minutes just to make sure you have not missed any pressure points. Helmet manufacturers have different ideas about the general size and shape of the human head. If you have trouble finding the proper fit, try a different brand of helmet, or even a different model by the same manufacturer. Be patient, work through all the steps for getting the right fit and you'll end up with the helmet that's right for you.