A tuning peg is used to hold a string in the pegbox of a stringed instrument. It may be made of ebony, rosewood, boxwood or other material. Some tuning pegs are ornamented with shell, metal, or plastic inlays, beads (pips) or rings.

Turning the peg tightens or loosens the string, changing the pitch produced when the string is played and thereby tuning it.
Friction pegs
Friction pegs are most often used on violin family instruments (not on the double bass, which typically uses geared tuning machines), as well as being used on older instruments, such as the Bulgarian gadulka and the hurdy gurdy, as well as on flamenco guitars.
A properly working peg will turn easily and hold reliably, that is, it will neither stick nor slip. Modern pegs for violin family instruments have conical shafts, turned to a 30:1 taper, changing in diameter by 1 mm over a distance of 30 mm.
Geared pegs
Pegs for acoustic bass and guitar family instruments are usually geared, and are called tuning machines or machine heads. Geared pegs for violin family instruments also exist, although they have not gained wide use. The most recently marketed pegs of this sort use planetary gears designed to fit inside a case shaped like a friction peg.