ABC Notation Beginner Cheatsheet

A concise reference for common ABC notation features, with a slight bias toward piano and classical engraving. For more detailed information on ABC check out "Making Music with Abc 2".


1. Minimal tune structure

X:1
T:Title
C:Composer
M:4/4
L:1/8
Q:1/4=120
K:C
C D E F | G A B c |]

Important header fields:

X:   reference number
T:   title
C:   composer
M:   meter, e.g. 4/4, 3/4, 6/8
L:   default note length, e.g. 1/8
Q:   tempo
K:   key; also ends the header

2. Notes and octaves

C D E F G A B     % middle-ish octave
c d e f g a b     % octave above
C, D, E,           % octave below
c' d' e'           % octave above lowercase

Roughly:

C,  lower C
C   C
c   higher C
c'  still higher C

3. Note lengths

The L: field defines the default note length.

If:

L:1/8

then:

C     eighth note
C2    quarter note
C4    half note
C/    sixteenth note
C/2   thirty-second note
C3    dotted-quarter length, i.e. 3 eighths

Example:

L:1/8
C D E F | G2 A2 B4 |]

4. Rests

z     visible rest
z2    visible rest, double length
x     invisible rest
x4    invisible rest, four units

Very useful for multi-voice piano notation:

C2 E2 G2 c2 | x8 |

z prints a rest; x takes rhythmic space but is invisible.


5. Bar lines

|     normal bar line
||    double bar line
|]    final bar line
[|    start thick-thin bar line
|:    start repeat
:|    end repeat
:|:   end repeat + start repeat

Example:

C D E F | G A B c |]

6. Accidentals

^C    C sharp
^^C   C double sharp
_C    C flat
__C   C double flat
=C    C natural

Example:

^F G _B =B |

7. Ties and slurs

C-C     tie
(C D E) slur

Example:

C2-C2 | (E F G A) |

8. Tuplets

Simple triplet:

(3CDE

General form:

(p:q:r

Meaning: put p notes into the time of q, applying to the next r notes.

Examples:

(3CDE          % triplet: 3 in the time of 2
(5:4:5 CDEFG  % 5 in the time of 4
(5:4:4 A2B2c3d3

The last one applies a quintuplet ratio to the next four notes, which is useful when the visible note count is not the same as the tuplet number.


9. Chords

Notes sounding together go inside square brackets:

[CEG]     C major chord
[C2E2G2]  longer chord

Example:

[CEG]2 [DFA]2 | [EGB]4 |

10. Grace notes

{g}A
{abc}d

Example:

{g}A2 B2 | {abc}d4 |

11. Decorations and articulations

ABC uses decorations between exclamation marks:

!trill!C
!fermata!C
!accent!C
!staccato!C

Short forms often exist too, depending on renderer:

.C    staccato
~C    roll / ornament, context-dependent

Fingerings are commonly written as decorations:

!1!C
!2!D
!3!E
!4!F
!5!G

But forced placement is better done with annotations:

"^4"F    fingering/text above
"_4"F    fingering/text below

12. Text annotations

"^text"C   above note
"_text"C   below note
"<text"C   left of note
">text"C   right of note

Examples:

"^dolce"C2 D2 |
"_4"F2 A2 |

13. Voices

Define voices in the header or before use:

V:1
V:2

Use them in the music:

[V:1] C2 D2 E2 F2 |
[V:2] G,4 z4 |

For piano-style multiple voices:

V:1 clef=treble stem=up
V:2 clef=treble stem=down
V:3 clef=bass stem=up
V:4 clef=bass stem=down

Then:

[V:1] c2 d2 e2 f2 |
[V:2] G4 x4 |
[V:3] C,2 E,2 G,2 C2 |
[V:4] x8 |

14. Staves and piano layout

Many renderers support:

%%score (1 2) | (3 4)

or:

%%staves (1 2) (3 4)

Typical piano setup:

%%score (RH1 RH2) | (LH1 LH2)
V:RH1 clef=treble stem=up
V:RH2 clef=treble stem=down
V:LH1 clef=bass stem=up
V:LH2 clef=bass stem=down

15. Clefs

K:C clef=treble
K:C clef=bass
K:C clef=alto

Or in voices:

V:1 clef=treble
V:2 clef=bass

16. Key signatures

K:C
K:G
K:D
K:F
K:Bb
K:Am
K:Em

Minor keys usually use m:

K:Dm
K:Gm

17. Meter and default note length

M:4/4
M:3/4
M:6/8
M:C      % common time
M:C|     % cut time

Default length:

L:1/8
L:1/16

For classical piano, L:1/16 is often convenient when there are many small subdivisions.


18. Repeats and endings

|: C D E F | G A B c :|

First and second endings:

|: C D E F |1 G A B c :|2 c B A G |]

19. Lyrics

Lyrics go on w: lines after the music line:

C D E F | G A B c |
w: La la la la la la la la

20. Comments

% this is a comment

Example:

C D E F | % first bar
G A B c |]

21. Useful renderer directives

These start with %% and are renderer-dependent:

%%titlefont Times 18
%%measurenb 0
%%annotationfont Times-Italic 12
%%staffsep 60
%%score (1 2) | (3 4)
%%staves (RH LH)

Two useful defaults for practice scores are:

Inline instructions sometimes use:

[I:instruction]

22. Tiny complete piano-style example

X:1
T:Tiny Piano Example
M:4/4
L:1/8
K:C
%%score (RH1 RH2) | (LH1 LH2)
V:RH1 clef=treble stem=up
V:RH2 clef=treble stem=down
V:LH1 clef=bass stem=up
V:LH2 clef=bass stem=down

[V:RH1] c2 d2 e2 f2 | g4 e4 |]
[V:RH2] x8           | "_4"c4 x4 |]
[V:LH1] C,2 E,2 G,2 C2 | x8 |]
[V:LH2] x8              | C,,8 |]

23. The most useful ABC tricks

x       invisible rest
"_4"C   force fingering/text below
"^4"C   force fingering/text above
stem=up / stem=down   control voice stem direction
(3ABC   triplet
(5:4:4  advanced tuplet
|]      final bar line
[CEG]   chord
C-C     tie
(CDE)   slur

Advanced techniques

The following techniques are useful in WikiMusic.org but go beyond the portable ABC basics.

Give a score its own two-page layout

If one score needs a different page height or system spacing than your usual settings, place either or both of these optional fields in its WikiMusic.org metadata block before X::

%wm-two-page-height-percent: 95
%wm-two-page-system-spacing-adjustment: -20

The values apply only to that score and do not change the settings saved in the browser. If one field is omitted, that part of the layout continues to use the saved setting. Page height must be greater than zero; system spacing must be from -100 through 200. These are WikiMusic.org-specific metadata fields and other ABC programs may ignore them.

Color one note-name annotation

For a very high or low note, a small note-name reminder can be placed above or below the staff and colored independently. Define an abc2svg font class once, before the music:

%%beginsvg
<style>
.red-note-label { fill: #c00000; color: #c00000; }
</style>
%%endsvg
%%setfont-1 Times-Italic-Bold 12 class=red-note-label

Then select that font only inside the annotation:

"^$1e$0"e'''   % red e above a very high E
"_$1E$0"E,,,   % red E below a very low E

If font slot 1 is already used, choose another slot from 2 through 9 and change both %%setfont-1 and $1 accordingly. This CSS-class technique is specific to abc2svg and may be ignored by other ABC renderers.


Notes on portability

ABC is standardized, but renderers differ. Core notation such as notes, rests, tuplets, voices, chords, ties, slurs, and bar lines is generally portable. Layout directives such as %%score, %%staves, font settings, and some inline I: instructions are more renderer-dependent. For more detailed information on ABC check out "Making Music with Abc 2".