The form a is used before a word beggining with a consonant, or a vowel with a consonant sound. ex: a mam, a had, a university, a European.
The form an is used before words beginning with a vowel(a,e,i,o,u) or words beginning with mude h. ex: an apple, an hour, an egg.
Or individual letters spoken wih vowel sound. Ex: an L-plate, an MP, as "x", an SOS.
A/AN is the same of all genders. EX: a man, a womam, an actor, an actress.