der Nagel
nail
A small, pointed metal pin with a flat head that is driven into wood or other materials to fasten things.
Er schlug einen Nagel in die Wand, um das neue Bild aufzuhängen.
He drove a nail into the wall to hang up the new picture.

nail
Loading your saved state.
nail
A small, pointed metal pin with a flat head that is driven into wood or other materials to fasten things.
Er schlug einen Nagel in die Wand, um das neue Bild aufzuhängen.
He drove a nail into the wall to hang up the new picture.

You distinguish the meanings by context. Verbs like 'hämmern' (to hammer) or 'einschlagen' (to drive in) and nouns like 'Wand' (wall) or 'Holz' (wood) point to the metal pin. Verbs like 'lackieren' (to paint/polish) or 'schneiden' (to cut) and nouns like 'Finger' (finger) or 'Zeh' (toe) point to the fingernail.
Kannst du mir den Hammer geben? Ich brauche noch einen Nagel.
Can you give me the hammer? I still need a nail.
When referring to the metal pin, the most important verbs are 'einschlagen' (to drive in) and 'ziehen' (to pull out). The typical construction is: 'einen Nagel in etwas (Akkusativ) schlagen' (to drive a nail into something, accusative).
Er hat den Nagel mit nur drei Schlägen in die Wand geschlagen.
He drove the nail into the wall with only three blows.
In the meaning 'Fingernagel' (fingernail), the word is often used with reflexive personal-care verbs. Typical phrases are 'sich die Nägel schneiden' (to cut one's nails), 'sich die Nägel feilen' (to file one's nails), or 'sich die Nägel lackieren' (to paint/polish one's nails).
Ich muss mir dringend mal wieder die Nägel schneiden.
I really need to cut my nails again.
The idiom 'etwas an den Nagel hängen' (to hang something up for good) means to give up an activity, profession, or hobby permanently. The thing you give up is in the accusative.
Nach der Geburt ihres Kindes hat sie ihren Job an den Nagel gehängt.
After the birth of her child, she gave up her job for good.
'Den Nagel auf den Kopf treffen' (to hit the nail on the head) is a very common idiom. It means that a comment or an analysis is exactly accurate.
Deine Beschreibung seines Charakters hat den Nagel auf den Kopf getroffen.
Your description of his character hit the nail on the head.
pen / pin / apprentice
'der Stift' and 'der Nagel' can both be small, longish parts used to fasten or connect something. 'Nagel' usually means a pointed metal piece with a head that you drive into wood or a wall with a hammer. 'Stift' is more general and often means a small pin or a part that connects, guides, or holds something in the right position. Learners may confuse the words because a nail looks like a kind of pin. If you drive something in, 'Nagel' is usually correct; in technical contexts, furniture, or small connecting parts, 'Stift' often fits.

Tom schlägt einen Nagel in die Wand, um das Bild aufzuhängen.
Tom drives a nail into the wall to hang up the picture.
Der kleine Stift hält die beiden Teile des Regals zusammen.
The small pin holds the two parts of the shelf together.