Skip to content

ABC Notation Basics

ABC is a text-based music notation format. This page only covers its basics. The full specification is here.

An ABC file can contain one or more tunes. Before the first tune, the file can have a file header where directives and info lines are shared across all tunes. Each tune then starts with its own header lines followed by the tune body:

%%abcls-fmt courtesy-accidentals % file header: applies to all tunes
%%pagewidth 21cm
X:1 % tune number (required, must be first header line)
T:My Tune % title
M:4/4 % meter (time signature)
L:1/8 % default note length
K:C % key signature (must be the last header line)
CDEF GABc| % some music

Structure example

The file header is the area before the first X: line. It is typically used for stylesheet directives (page layout, fonts, spacing) and abcls configuration that should apply to all tunes in the file. Any directive or setting placed in the file header acts as a default that individual tunes can override in their own headers.

Notes are written as letters. Uppercase letters represent the lower octave, lowercase letters represent the octave above:

C D E F G A B c d e f g a b

Notes example

Octave modifiers shift notes further up or down:

  • c' — one octave above c
  • C, — one octave below C
  • These can be stacked: c'' is two octaves above c

Accidentals are written before the note letter:

  • ^C — C sharp
  • _C — C flat
  • =C — C natural
  • ^^C — C double-sharp
  • __C — C double-flat
^C _C =C ^^C __C

Accidentals example

Note lengths are written relative to the default length (L: header). If L:1/8, then:

  • A — eighth note
  • A2 — quarter note (twice the default)
  • A/2 — sixteenth note (half the default)
  • A3/2 — dotted eighth (1.5 times the default)
A A2 A/2 A3/2 A/ A3

Rhythm example

  • z — rest (same length rules as notes)
  • z2 — rest lasting two default units
  • Z — whole-measure rest
z z2 z/2 | Z |

Rests example

Bar lines separate measures:

  • | — regular bar line
  • || — double bar line
  • |] — thin-thick double bar (end of piece)
  • [| — thick-thin double bar
  • :| and |: — repeat bars, can be numbered using :|1,2

Square brackets group simultaneous notes into a chord:

[CEG] [FAc] [GBd]

Chords example

Chord symbols are written in double quotes before a note:

"Cmaj7" c "Dm7" d "G7" G

Chord symbols example

Note that content in double quotes can also be anything you want to write.