There is not a fail-safe way to know which size of helmet to buy online. Ideally, you would be able to walk into our ChutingStar shop and try a bunch on, or be able to try on helmets at your local drop zone. But for some, it's just not possible.
Each manufacturer does post a size chart for its helmets. And that is a great starting point. You'll want to get a soft tape measure, which you can find in the sewing section of any grocery store. Measure around your head, level with your forehead and behind your ears.