"A" and "an" are both indefinite articles used for the same purpose. As indefinite articles, they are used before singular nouns when the noun does not make reference to a specific object or idea. For example, there may be "a" man or "an" animal, but not a particular man or animal.
Which Article to Use
When choosing between "a" and "an," refer to the beginning sound of the word that follows the article. "A" appears before words that begin with a consonant sound and "an" appears before words that begin with a vowel sound. Note that you are considering the opening sound of the following word, not the written letter itself. So, you would have "a" bucket or "an" avocado. However, you would say "an" honest man. In this case, even though "honest" begins with a consonant, it takes on a vowel sound and uses "an" rather than "a." On the other hand, if you have a word that starts with a vowel sounding like a consonant, you would use "a" rather than "an." For example, you would say "a one-term president" because the initial sound in "one" sounds like the consonant "w."