an
on / at
Indicates a position on a vertical surface or at a boundary (e.g., water, edge). Answers 'Wo?' (where?) and is used with the dative.
Das Bild hängt an der Wand.
The picture is hanging on the wall.

at / on
Loading your saved state.
on / at
Indicates a position on a vertical surface or at a boundary (e.g., water, edge). Answers 'Wo?' (where?) and is used with the dative.
Das Bild hängt an der Wand.
The picture is hanging on the wall.

'An' is a two-way preposition. It is used with the dative to describe a location (question: 'Wo?' — where?), and with the accusative to indicate a direction (question: 'Wohin?' — where to?).
Die Jacke hängt an der Garderobe. (Wo? -> Dativ)
The jacket is hanging on the coat rack. (Where? -> dative)
'An' is often contracted with the article into one word. 'An dem' becomes 'am', and 'an das' becomes 'ans'. These short forms are very common in both spoken and written language.
Wir treffen uns am Bahnhof.
We're meeting at the train station.
The preposition 'an' is typically used for places on vertical surfaces (e.g., wall, door, board) or at boundaries (e.g., river, sea, window, edge).
Der Zettel klebt am Kühlschrank.
The note is stuck on the fridge.
For time expressions, 'an' (usually as 'am') is used for days of the week, dates, and times of day (except 'in der Nacht' — at night). Typical examples are 'am Montag' (on Monday), 'am Abend' (in the evening), or 'am 25. Dezember' (on December 25).
Am Wochenende habe ich frei.
I have the weekend off.
Many verbs that express a mental connection have a fixed construction with 'an' + accusative. Important examples are 'denken an' (to think of/about), 'sich erinnern an' (to remember), 'glauben an' (to believe in), and 'sich gewöhnen an' (to get used to).
Sie erinnert sich gern an ihre Kindheit.
She fondly remembers her childhood.
Some verbs are fixed with 'an' + dative. These include 'teilnehmen an' (to participate in), 'leiden an' (to suffer from), 'sterben an' (to die of/from), and 'zweifeln an' (to doubt). This often involves participation or causes.
Möchtest du am Wettbewerb teilnehmen?
Would you like to participate in the competition?
As an adverb or as part of a separable verb, 'an' means something like 'eingeschaltet' (switched on). It is the opposite of 'aus' (off).
Bitte lass das Radio nicht die ganze Zeit an.
Please don't leave the radio on the whole time.
a / one
'ein' and 'an' are easy for learners to confuse because they are short and can look or sound similar. But they have very different functions. 'ein' comes before a masculine or neuter singular noun, or means the number 1. 'an' is usually a preposition and describes, for example, a place, a direction, or a time, or it is fixed with certain verbs. So you cannot simply swap these words. A simple guide is: before a noun like 'ein Tisch' (a table), 'ein' fits; in phrases like 'an der Wand' (on the wall), 'an den Tisch' (to the table), or 'am Montag' (on Monday), you need 'an'.

Am Nachmittag haben die Eltern im Krankenhaus an der Tür gewartet.
In the afternoon, the parents waited at the door in the hospital.
Ein alter Schrank steht heute in der Werkstatt, weil mein Vater ihn repariert.
An old cupboard is in the workshop today because my father is repairing it.