Discerning between sexes often requires a considerable degree of skill, not because visual discrimination is particularly difficult, but because getting the hedgehog to uncurl can be something of an art!
Early authors suggested that adult females are lighter in colour and have longer and more pointed snouts than males, but none of these apparent differences bear up to scrutiny. In practical terms, telling male from female at distance is largely impossible. I say “largely”, because there are occasions when the penis is visible. Often the penis will be exposed while the male is attempting to mount a female and I have seen one male gyrating on our patio with his penis extended and no obvious female in the vicinity. Male hedgehogs are ascrotal, literally “without a scrotum”, which means their testes remain inside the body, rather than descending into the scrotum as they do in most mammals. In other words, you can't see a hedgehogs testicles so they can't be used to help establish the animal's gender at distance.
If the animal can be restrained, or a clear view of the underside can be made, sexing is relatively simple based on the distance between the anus and genitals. The anus of both sexes is near the base of the tail, but males have a penis situated approximately medially on their belly, roughly where one might expect a belly button, about 5-6 cm (2.5 in.) away. As Lenni Sykes and Jane Durrant put it in Natural Hedgehog, if you feel the middle of a hog’s belly and there’s nothing but fur, it’s a female. In her 1997 book, Everything You Wanted to Know About Hedgehogs, Dilys Breese explained:
“In adult males the penis shows as a large projection approximately where you would expect the navel to be, about 5 cm [2 inches] in front of the base of the tail. In females there are two openings close together, near the base of the tail.”
Indeed, in females the genitals and anus are only around a centimetre apart (0.5 in.). This technique can be a little more difficult in hoglets, because the penis and anus start out closer together and separate (i.e. the penis migrates forward) as the animal grows. Males are sometimes referred to as boars and females as sows.