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".
AI assistance: ChatGPT understands ABC notation quite well and can answer most ABC questions, explain unfamiliar syntax, and edit or modify ABC source. Describe the desired musical change and include the relevant ABC passage, then preview, listen to, and compare the result with a trusted score because AI-generated changes can still contain errors. ChatGPT is an external service; ABC pasted into it leaves WikiMusic.org and is handled under that service's own privacy terms.
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:
-
%%measurenb 0prints the current measure number at the beginning of each music line. -
%%annotationfont Times-Italic 12displays above- and below-staff annotations in 12-point italic Times.
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.
Change voice, staff, and clef inline
These inline fields are useful when a voice changes engraving behavior in the middle of a passage:
[V:2 stem=up]
[I:staff +1]
[K:treble]
-
[V:2 stem=up]selects voice 2 and forces its following stems upward. Usestem=downwhen the stems should point downward. -
[I:staff +1]moves the following notes of the current voice to the next staff, normally the staff below. Use[I:staff -1]to move back to the preceding staff. This is especially useful for cross-staff keyboard notation. -
[K:treble]changes the current voice to the treble clef at that point without changing the existing key signature. Use[K:bass]to change to the bass clef.
Each change remains active until a later inline field changes it again.
Position a slur above or below
abc2svg normally chooses the slur direction automatically. A comma or apostrophe immediately after the opening parenthesis forces the slur below or above the notes:
(C D E F) % automatic placement
(,C D E F) % force the slur below
('C D E F) % force the slur above
The closing parenthesis is unchanged.
Create a leading title page
A centered abc2svg text block followed by %%newpage creates a separate leading
page in WikiMusic.org's paginated views without adding an artificial X: tune:
%%begintext center
MOZART
Zwölf Variationen über
„Ah, vous dirai-je Maman“
%%endtext
%%newpage
Place the block after the tune header and before the first music. In two-page view the title
page occupies the left side and the first score page begins on the right. The following
music continues to paginate automatically unless it contains additional
%%newpage directives. A normal title without the title-page
%%newpage remains attached to the first musical system.
Start a new page or organ panel
Place the abc2svg directive %%newpage between complete systems where the next
paginated section should begin:
C D E F | $
%%newpage
G A B c | $
In the one-page view, the following system begins a new page while overflow pagination
remains automatic. In the two-page and experimental organ views, adding any such directive
switches to explicit groups: pages in the two-page view and fixed alternating upper/lower
panels in organ view. Without directives, those views paginate automatically. The
$ controls the music-line break; %%newpage controls the explicit page
or panel boundary. Continuous view remains a scrolling score.
Give a score its own paginated 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. WikiMusic.org applies them to its one-page, two-page, and experimental
organ views.
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
-
^places the annotation above the staff;_places it below. -
$1selects the red custom font;$0restores the normal annotation font. - The note after the closing quotation mark is the note that is played and rendered.
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".