ein
a / an
Indefinite article that accompanies a masculine noun in the singular nominative or a neuter noun in the singular nominative or accusative.
Ein Mann kauft ein Auto.
A man is buying a car.

a / one
Loading your saved state.
a / an
Indefinite article that accompanies a masculine noun in the singular nominative or a neuter noun in the singular nominative or accusative.
Ein Mann kauft ein Auto.
A man is buying a car.

The endings of 'ein' (a/one) are the pattern for a whole group of words, which also includes 'kein' (no/not any) and the possessive articles (mein, dein, sein, etc.). If you learn the declension of 'ein', you can also use all these other words correctly.
Das ist ein Hund, das ist mein Hund, und das ist kein Hund.
That is a dog, that is my dog, and that is not a dog.
When 'ein' (one) stands alone without a noun, it gets an ending. For masculine nouns it becomes 'einer', and for neuter nouns usually 'eins'.
Ist hier ein Arzt? – Ja, ich bin einer.
Is there a doctor here? – Yes, I am one.
In two important cases, 'ein' (a/an) has no ending: before a masculine noun in the nominative and before a neuter noun in the nominative and accusative.
Ein Mann steht vor der Tür.
A man is standing at the door.
Whether 'ein' means an indefinite article or the number word '1' depends on the stress. As a number word, it is strongly stressed to indicate a quantity.
Ich hätte gern ein Brötchen.
I would like a bread roll.
the
'der' and 'ein' can both come before a masculine singular noun. However, they differ in whether the thing or person is already specific. You use 'der' when it is clear which person or thing is meant. You use 'ein' when something is new, not more precisely known, or not especially specific. In this sense, they are opposites: definite versus indefinite. Learners often confuse them because both can appear in the same place in a sentence, for example before 'Mann' (man) or 'Tisch' (table). The simple question is: does the listener already know which one is meant? Then 'der' is more likely. If not, 'ein' is more likely.

Für die Prüfung erklärt der Lehrer ein Beispiel an der Tafel.
For the exam, the teacher explains an example on the board.
Im Park liest der Mann ein Buch auf der Bank.
In the park, the man is reading a book on the bench.