Staaarter

SGF to GIF Converter

Parses an SGF (Smart Game Format) Go game record's ';B[xy]'/';W[xy]' move nodes and renders one animated GIF frame per move, reusing this codebase's existing Go board model, with a new pixel renderer. This is an honestly-scoped first pass: no capture logic and no game-tree variation branching. A free online tool from Staaarter, right in your browser.

Runs locallyUpdated 2026-07-29
By Staaarter Team
convertergifgogenerator

Overview

Introduction

This tool turns an SGF Go game record into a simple animated GIF, playing through the recorded moves one at a time so you can watch stones accumulate on the board.

It's built on this codebase's existing Go board model, adding a purpose-built pixel renderer and an honestly-scoped, capture-free move sequencer.

What Is SGF to GIF Converter?

SGF (Smart Game Format) is the standard plain-text format for recording Go (and several other board games), using nodes like ';B[pd]' and ';W[dd]' to record each move's color and board coordinate.

This tool extracts that move sequence, places one stone per move onto a Go board, and renders the result as one frame of an animated GIF per move.

How SGF to GIF Converter Works

The SGF text is scanned for its SZ[..] board-size property (defaulting to 19 if absent) and every ';B[xy]'/';W[xy]' move node, in the order they appear in the file.

Each move's two-letter coordinate is converted to a row/column (SGF uses the full a-z alphabet for coordinates, unlike human Go notation, which skips the letter 'I') and a stone of the matching color is placed there; the board after every move is rendered as one RGBA frame using a purpose-built rasterizer and encoded as a GIF via this category's shared codec.

When To Use SGF to GIF Converter

Use it to get a quick, shareable visual replay of a Go game from its SGF record, especially for games with no captures (openings, joseki sequences, life-and-death problems set up move by move).

Don't use it for games where captures matter to understanding the final position: captured stones incorrectly remain on the board here.

Features

Advantages

  • Reuses this codebase's existing, already-tested Go board model rather than inventing a new one.
  • Correctly detects and renders 9x9, 13x13, and 19x19 board sizes from the SGF's own SZ[..] property.
  • Handles pass moves (an empty '[]' coordinate) gracefully, without crashing or misinterpreting them as a stone placement.

Limitations

  • No stone-capture logic is implemented: stones simply accumulate move by move, so any group that would have been captured in a real game incorrectly remains on the board.
  • SGF's game-tree branching (parenthesized variations) isn't tracked: every move node in the file is flattened into one linear sequence, which will incorrectly mix moves from different variation branches if the file actually contains any.
  • Only the ';B[xy]'/';W[xy]' move properties are read; other SGF properties (player names, comments, handicap stone setup via AB/AW, markup) are ignored entirely.

Examples

Animating a short 9x9 opening sequence

Input

(;GM[1]FF[4]SZ[9]PB[Black]PW[White];B[ee];W[gc];B[cg];W[cc];B[gg];W[ge];B[ec];W[eg])

Output

A 9-frame animated GIF (empty board + 8 moves) on a 240x240 9x9 board diagram

Each of the 8 move nodes is extracted in order, alternating black and white stones are placed at their decoded coordinates, and one frame is rendered per move.

Best Practices & Notes

Best Practices

  • Use this tool for capture-free sequences (openings, problems, joseki) where the lack of capture handling won't misrepresent the position.
  • If your SGF file contains variations, extract just the main line into its own SGF text first, since this tool flattens all branches into one sequence.
  • Keep games under this category's 256-frame GIF limit; very long game records may need trimming first.

Developer Notes

convertSgfToGif detects board size via a simple SZ[..] regex (falling back to 19), then extracts every ;B[xy]/;W[xy] node with a single regex scan (parseSgfMoves) rather than a real recursive-descent SGF parser: this deliberately doesn't track paren depth, so variation branches are flattened, a documented, explicit tradeoff for keeping this a genuinely honest first pass rather than a silently-wrong 'looks like it handles variations' implementation. Stones are placed directly onto a GoBoard from random/lib/go-board.ts with no adjacency/liberty/capture logic at all.

SGF to GIF Converter Use Cases

  • Sharing a quick visual walkthrough of a Go opening or joseki sequence from its SGF record
  • Turning a short SGF life-and-death problem into a GIF preview for a blog post or forum
  • Visually spot-checking an SGF file's move coordinates for obvious errors

Common Mistakes

  • Assuming captured stones will disappear from the board: they won't, since no capture logic is implemented.
  • Uploading an SGF with multiple variation branches and expecting only the main line to be played; every branch's moves are flattened into one sequence here.

Tips

  • For a game with important captures, treat this tool's output as a rough visual guide to move order rather than a fully accurate final position.
  • Pair with gif-to-zip-archive-converter to export the animation's individual frames as separate PNGs for a move-by-move slideshow instead.

References

Frequently Asked Questions