How Diagrams Work

    Keywords: SL description

This page describes how to create diagrams on Senseis' Library. To understand the information conveyed in the diagrams, see how to read diagrams instead.

Table of contents Table of diagrams
A [joseki] variation
Black to play
White to play
Ko (5 at 1, 8 at 2)
Move numbering starts at 67
5Χ5 board (compact notation)
Board markup
Nadare joseki
Nadare joseki on a small board
Links in diagrams - examples
Example: using arrows to show influence
Lines off the board
Lines on the board
A comparison diagram with empty space
Empty space produced with “-”
diagram code

A joseki variation  

Diagrams make discussing Go much easier. Don't worry! They are quite easy to use.

SGF files are generated automatically from diagrams. Clicking on a diagram will download the corresponding SGF file. You may wish to examine some of these diagrams with your favorite SGF editor.

Any diagram can be used for position search, by clicking the binocular symbol at the end of the caption.

As you read these instructions, it may be helpful to open Edit page in a second window to see what's under the hood. Before closing it, please press cancel.


The previous diagram was created by this code:

$$ A [joseki] variation
$$  ------------------
$$ | . . . . . . . . .
$$ | . . . . . . . . .
$$ | . . 7 3 X d . . .
$$ | . . O 1 O 6 . . .
$$ | . . 4 2 5 c . . .
$$ | . . 8 X a . . . .
$$ | . . . b . . . . .
$$ | . . . . . . . . .
$$ | . . . . . . . . .

All diagram lines start with two dollar signs (“$$”), which may be followed by a space for legibility, except in the first line.

The title of the diagram goes on the first line, separated from the dollar signs by a space (“ ”) (so “$$B” does not do the same as “$$ B”).

The rest of the lines describe the board. The syntax used is similar to that commonly used in newsgroups and email:

  • A dot (“.”) makes an empty intersection.
  • “X” makes a black stone and “O” a white one.
  • A comma (“,”) makes a hoshi (star point).
  • Empty space at the edge of the board is made by any of “|”, “+” and “-”.
    • These three symbols are interchangeable and can be mixed up in the same diagram, but “|” is usually used at the sides, “+” at the corners and “-” at the top and bottom.
  • The edge of the board is automatically made at those outermost dots which have space outside them (see the previous point).
    • Hence the above code produces a diagram for the top left-hand corner.
    • Dots with no space outside them are treated as internal points on the board, indicated (as usual) by half-lines coming away from them.


You can represent a sequence of moves with the numbers 1-9 and 0 (0 represents move 10). You can only have ten moves, but they can start at any number you want (see below) (e.g. 22 through 31, or any other starting number) in one diagram[3].

Black or White to play

By default, move 1 and all odd-numbered moves are black, and all even-numbered moves are white. You can reverse this by putting “W” after the dollar signs on the first line: “$$W”. Using “B” makes explicit the default behavior of Black going first. Think of a line beginning with “$$B” as meaning “Black to play”.

Black to play  
White to play  

Moves at an occupied point and passes

Ko (5 at 1, 8 at 2)  

If two moves are made at the same intersection, put the second move in the diagram's title in the form “a at b” (for example, “5 at 1”). This causes the move to be included in the generated SGF file.

Passes should also be mentioned in the title, e.g. “5 = pass”. As of 2019-01-29 there is a Bug Report ([ext] asking for these to be included in the generated SGF file.

Starting move number

Move numbering starts at 67  

You can also start the move numbering at something other than 1 by adding 'mX' (X being the starting move number) to the first line. The first line for this diagram reads “$$Wm67 title text”. Beware: this feature is ineffective in preview (OTF) mode.

Although the stones show at most two digits, you can specify a higher first move. E.g. “$$Wm141” lets the moves start at '41'. Please use the correct move number whenever possible, even though only the last two digits are shown in the diagram.

Empty boards

You can create an empty 19Χ19 board with the [ext] tool at Sensei's Library or Kombilo; the page Empty Boards contains a selection of other sizes (5, 7, 9, 11, 13, 19).

For example, you can use something like this for 5Χ5:

$$B 5Χ5 board (compact notation)


5Χ5 board (compact notation)  

(It is easier to copy this example without editing the page, as otherwise you will need to remove the space at the start of each line.)


Diagrams can contain markup, and then be referred to in the text:

Board markup  

  In      In     Appears   Meaning
Diagram  Text      as
———————— ——————— ————————— ———————————————————————————————————
  X       BO       B      plain black stone
  O       WO       W      plain white stone
1..9     B1,W2    B1,W2    Black's move 1, White's move 2 [3]
0 (zero) B10,W10  B10,W10    Black's or White's move 10 [3]
  —     B11–B100  B11–B100   Black's or White's move 11–100
  B       BC       black+circle      black stone with circle
  W       WC       white+circle      white stone with circle
  #       BS       black+square      black stone with square
  @       WS       white+square      white stone with square
  Y       BT       black+triangle      black stone with triangle (omitted OTF†)
  Q       WT       white+triangle      white stone with triangle (appears as white+square OTF†)
  Z       BX       black+cross      black stone with cross mark (X) (omitted OTF†)
  P       WX       white+cross      white stone with cross mark (X) (omitted OTF†)
  C       EC       circle      circle on empty intersection
  S       ES       square      square on empty intersection
  T       ET       triangle      triangle on empty intersection (omitted OTF†)
  M       EX       cross      cross mark (X) on empty intersection (omitted OTF†)
a..z     a..z     a..z     letter on empty intersection
Markup for position search:
  ?        —        —      an empty point not in the search pattern
  A        —        —      wildcard: matches an empty point or a black stone
  V        —        —      wildcard: matches an empty point or a white stone

† Markup marked as “(omitted OTF†)” does not appear properly while editing diagrams (“on-the-fly”).

Position search and markup

Diagrams can include wildcards for use with position search, as described at the end of the previous.

Coordinate markers and board size

Nadare joseki  

You can cause a diagram to show coordinate markers by putting "c" after the dollar signs on the first line: "$$c". The "c" must follow the color indicator ("B" or "W"), if present: "$$Bc".

The diagram must show at least two perpendicular edges for the coordinate markers to appear.

There are other coordinate systems. But only the style A1 is supported here.

Nadare joseki on a small board  

If the diagram shows an entire board (that is, it shows all four edges), then its size will be calculated automatically. You can specify a size for a partial board by placing it after the dollar signs on the first line: "$$13". The size must follow the color indicator and "c", if present: "$$B13", "$$c13" or "$$Bc13". Without an explicit size, a partial board will be assumed to be 19x19.

Note that the coordinate markers on the left of the example diagram go to 13 rather than 19.

Links in diagrams


$$ [ MarkupCharacter | PageName ]

Just add lines like the upper one at the bottom of a diagram to create a link between a marked stone/point and a page.

is the same character used on the board itself.
is any name, external link, or local name.

[2] Examples:

The following diagram contains three examples for links. It is the result of the code following it.

#1 NadareJoseki #1

OTF: Links in diagrams - examples  

$$ Links in diagrams - examples
$$  --------------
$$ | . . . . . . .
$$ | . C . . . . .
$$ | . . . 1 6 . .
$$ | . . 5 4 . . .
$$ | . . 3 2 . . .
$$ | . . a . . C .
$$ | . . . . . . .
$$ [2|NadareJoseki] [21]
$$ [a|] [22]
$$ [C|#1] [23]

[21] links W2 to the page called NadareJoseki.
[22] links a to Arno's GTL info.
[23] links all the circled points to the footnote called [#1].

Works with every kind of markup and with marked stones. Does not work with plain stones or on the empty board.

Lines and Arrows

You can also draw lines and arrows in any directions between points on the board:

Example: using arrows to show influence  

Note that lines and arrows do not appear on the fly (while editing).

As it is hard to visualize and edit such lines in edit mode, lines and arrows are specified in extra lines - usually after the diagram. The code for this diagram looks like this:

$$ {AR C14 C11}
$$ {AR 5:6 6:9}

The syntax basically is "$$ {command point1 point2}". Command can be either AR for arrows or LN for lines. Coordinates can be given in two different ways:

board coordinates
this is the usual Go coordinate system. Points are denoted as A1 .. T19. For this to work the diagram has to be anchored in at least one corner, i.e. center diagrams cannot use this method. Basically, if you can switch on coordinates with the $$c option then this method works.
absolute coordinates
points are denoted in 'X:Y' syntax. X and Y are a coordinate system with the root being in the upper left – numbering starts at 1:1. The second arrow in the example uses this system. These coordinates will always work, as they do not rely on borders and corners.

Lines off the board

Since “+” produces empty space, you can add an empty border around the board if you need lines to go outside the edges.

For this diagram:

Lines off the board  

use this code:

$$B Lines off the board
$$ +--------------------
$$ | + + + + + + + + + +
$$ | + . X . . X . X . .
$$ | + X X . . X X X . .
$$ | + . . . . . . . . .
$$ {LN 1:1 1:3}
$$ {LN 1:3 3:3}
$$ {LN 3:3 3:1}
$$ {LN 3:1 1:1}
$$ {LN 6:1 6:3}
$$ {LN 6:3 8:3}
$$ {LN 8:3 8:1}
$$ {LN 8:1 6:1}

Observe that the coordinates ignore the outermost empty space, but include the rest.

Lines on the board  

use this code:

$$ Lines on the board
$$ +---------
$$ | . . . .
$$ | . . . .
$$ | . . . .
$$ | . . . .
$$ {LN 1:1 3:1}
$$ {LN 3:1 3:3}
$$ {LN 3:3 1:3}
$$ {LN 1:3 1:1}

Comparison diagrams

A comparison diagram with empty space  

This diagram is created by the following code, using underscore (‘_’) to produce the empty spaces.

$$B A comparison diagram with empty space
$$ ------------------------
$$  _ X O . O _ _ X . X O _
$$  _ X O . O _ _ X . X O _
$$  _ X O . O _ _ X . X O _
$$  _ X W . O _ _ X . . O _
$$  _ X . . O _ _ X . B O _
$$  _ X O O O _ _ X X X O _
$$  _ _ _ _ _ _ _ _ _ _ _ _

To avoid empty space around the edges and half-lines internally, however, use minus (‘-’) instead:

Empty space produced with “-”  

is created by

$$B Empty space produced with “-”, “_”
$$ ------------------------
$$  - X O . O - - X . X O -
$$  - X O . O - - X . X O -
$$  - . . . . - - . . . . -
$$  - . . . . - - . . . . -
$$  - . . . . _ _ . . . . -
$$  - . . . . _ _ . . . . -
$$  - . . . . _ _ . . . . -
$$  - - - - - - - - - - - -

N.B. On the fly, empty space created with “-”, “+” or “|” is omitted.

N.B. ‘+’ sometimes also creates empty points, as in the example above under ‘Lines off the board’.

Stones in Text

In text, you can refer to stones like this:

B1, W2 ... B99, W100, BC, BS, BT, BX, BO, WC, WS, WT, WX, WO, ES, EC, ET, EX

This will appear like this:

B1, W2 ... B99, W100, black+circle, black+square, black+triangle, black+cross, B, white+circle, white+square, white+triangle, white+cross, W, circle, square, triangle, cross

You can suppress the special meaning of these words by preceeding them with an exclamation mark: i.e. !BC gives BC.

Inlining thumbnail diagrams

[thumbnail diagram] You can inline thumbnail diagrams from other pages by adding :i in the link, e. g. [33PointInvasion:i] results in the diagram on the left. If no number is given after :i, the first diagram of that page is inlined.
[thumbnail diagram] You can also name the link for a hover text, e. g. [hover text | 33PointInvasion:i].
[thumbnail diagram] By adding a number like :i3 you can inline a specific diagram in that page, e. g. the third diagram of the same page referenced as [33PointInvasion:i3] gives the diagram on the left.
You can even make much more, like linking to pages with a thumbnail taken from another page etc. For such special issues look at Special Templates / Image.

If you click on the thumbnail you are taken to the right position in the page.

Note: thumbnails have a size of about 7 kB (corner) to 25 kB (19x19 board middle game). Avoid inlining more than 50 thumbnail diagrams from other pages, otherwise the page download size may easily exceed 1 MB. If you have an index page, break it up into subpages with 50 thumbnails each at most.

Summary of options for the first line

The first line controls the behavior of the diagram. The basic syntax is:

$$(B,W)(c)(size)(m Num)(title)
   |    |  |     |      +----> title of the diagram
   |    |  |     +-----> starting move number (e.g m67 - no space!)
   |    |  +----> board size (for SGF and coordinates - default:19)
   |    +-> enable and show coordinates in the diagram image
   +--> first move is either by black (B) or white (W)

All parts are optional and can be omitted.

Force text below a diagram

4 percent signs (%) force a text to appear below a diagram

diagram code  

Text beginning in a new line

Other information

Diagrams that are shown when previewing edits look different from the normal diagrams you see in pages. See on-the-fly diagram.

Sensei's Library has [ext] a tool that generates a diagram from an SGF file. (A link to the tool is also given when you edit a page).

In order to set up a game position yourself, you may copy the diagram from the bottom of any edit page, or at Corner diagram for a corner position.

For odd board shapes, look at Creating Irregular Gobans With Wiki.


  • Kombilo also has a feature which allows diagram export for SL. Choose File > Export Current Position > Wiki Mode (check box).
    This directly produces diagrams in SL format.
  • Quarry can export diagrams for use at SL or, as well as a plain ASCII export. File > Export has both options.
  • Drago allows the user to select a rectangular area on the go board and export it to some formats including SL ASCII format, see SL Diagrams with Drago.
  • GOWrite allows the user to select a rectangular area on the go board and export it as SL syntax. This functionality is accessed through Edit > Copy Wizard.
  • SmartGo can export diagrams to ASCII format: Choose Edit > Copy as ASCII to create a diagram of the current board position. Choose Tools > Options > Edit and turn on Wiki format to produce the correct format for Sensei's Library. Choose View > Partial Board to select a rectangular area of the board.
  • DragonGoServer has a [ext] Goban-Editor, that uses the Sensei's Library style diagram format to form setups for shape-games or to be used inline for the DGS-forums. Diagrams can be created from DGS-games, uploaded from a SGF or created from scratch or copied from SL and previewed while changing it. Regular boards with most of the SL-diagram-features are supported.
  • Go4Go can export diagrams directly from its online SGF viewer to set up positions in professional games.
  • q5go allows the user to select a rectangular area and export it to ASCII format usable on SL. It also supports SGF diagrams representing move sequences, and can export these automatically to a series of ASCII diagrams with move numbers (again supporting rectangular sub-regions).

See also


[1] - This is the footnote referred to in the example diagram above [2].

[3] - Sorry! 10 moves ( 1 .. 0 become 1 through 10) is the maximum in one diagram. Inserting other numbers will not work. If you want a diagram with more than 10 moves in it, you can use a self made image hosted on another site (see how to add images) or use several diagrams, splitting the moves through them (See Ongoing Game 1 for an example).


If you are in edit-mode and scroll down the window you will see that we have put two diagrams there for you to copy & paste. Also, there's a quick help included as well. Any questions left?

Yes: I want an easy way to force a second diagram beside a first one (so to say 'on the same line'). No, the method in the chapter "Comparison diagrams" is too complicated.

For this, you can use tables. Because tables use a template, you shouldn't use the | character, but use the - character instead as a left/right border. For an example, see Leather Scroll Problem 49/ Attempts and edit the page.

How Diagrams Work last edited by PJTraill on March 2, 2023 - 12:58
RecentChanges · StartingPoints · About
Edit page ·Search · Related · Page info · Latest diff
[Welcome to Sensei's Library!]
Search position
Page history
Latest page diff
Partner sites:
Go Teaching Ladder
Login / Prefs
Sensei's Library