If you are familiar with the way a particular brand fits, there's little risk in buying a replacement online. E.g. I know from prior experience that a large Bell fits me just fine.
Of course, if you don't have that prior experience, it becomes a crapshoot.