Use 'a' before a consonant sound. Use 'an' before a vowel sound.
Notice that it is the sound of the letter that matters. Usually consonants start with consonant sounds, and vowels start with vowel sounds, but this is not always true. Let's look at some examples:
'A' Before a consonant sound:
'An' Before a vowel sound:
Just remember: the sound that follows 'a' should be a consonant sound, and the sound the follows 'an' should be a vowel sound.
I hope this helps.