How to Create ASCII Diagrams for Code Documentation (2026)
Draw boxes, arrows, and flowcharts in plain text for README files, code comments, and pull request descriptions. Free ASCII diagram editor.
- Text diagrams sit next to the code, show up in diffs and never lose an image link.
- Most “ASCII” diagrams are really Unicode box drawing; strict ASCII uses + - |.
- Box-drawing characters are East Asian Ambiguous width and can misalign in CJK terminals.
- On GitHub, use a code block for text diagrams, or Mermaid for larger diagrams rendered as graphics.
- Keep diagrams under 80 columns.
What Are ASCII Diagrams?
ASCII diagrams are pictures made of text characters, so they live in the same file as the code they describe. Strictly, ASCII means the 95 printable ASCII characters (space through tilde), and classic diagrams use only +, -, |, / and \. Most diagrams people call “ASCII” today, including this editor’s output, use Unicode instead: box-drawing characters from U+2500–U+257F (┌─┐│└┘) and arrowheads from the Geometric Shapes block (▲ ▼ ◄ ►). Either way the diagram is plain text: it is searchable, shows up in diffs, and cannot break because an image link died.
When to Use ASCII Art Over Images
Text diagrams earn their place where an image cannot go or would drift out of date: code comments, commit messages, terminal output and CLI help, and design notes that should change in the same pull request as the code. In a README or a GitHub issue you now have a second option: GitHub has rendered Mermaid diagrams from fenced mermaid code blocks since February 2022, so flowcharts, sequence diagrams and state machines can be written as text and displayed as graphics. Mermaid is the better choice when the diagram has more than a handful of boxes or needs to be read by people who never open the source file; a text diagram is the better choice when it has to read correctly in an editor, a terminal or a plain-text email.
Using the ASCII Diagram Editor
The editor has six tools: Box, Line, Arrow, Draw (a solid █ block), Erase and Text. Drag with Box, Line or Arrow to place a shape; lines and arrows bend once, in an L. Text puts one character in each cell. The canvas is 60 columns by 30 rows, and Copy ASCII trims trailing spaces from every line and blank lines from the end, so the pasted block is no wider than what you drew. Two behaviors to plan around: a line drawn across a box edge overwrites the border rather than making a junction (┼ ├ ┬), so draw boxes last or retype junctions with Text, and an L-shaped line dragged from right to left currently puts its corner the wrong way round, which one retyped character fixes.
Common Diagram Patterns
The most common text diagram is a row of boxes joined by arrows: client, API, database. File trees use ├── and └── (the style the tree command prints). Sequence diagrams put each participant in a column with a vertical line beneath it and horizontal arrows between them; state machines are boxes joined by labeled arrows. There is no diamond tool, so draw decision points as boxes with labeled branches, or type / and \ with the Text tool. Keep the width under 80 columns, the classic terminal width, so the diagram does not wrap in a split diff or a narrow terminal.
Why a diagram that looks right can misalign
A text diagram depends on every character taking exactly one column. Two things break that. The first is a proportional font: outside a code block, Markdown renders text in the page font and every box collapses, which is why diagrams go between triple backticks. The second is subtler. Unicode’s East Asian Width property (UAX #11) marks every box-drawing character from U+2500 to U+254B, the arrows ← ↑ → ↓ and the triangles ▲ ▼ as Ambiguous: narrow in Western contexts, but often drawn two columns wide by terminals and editors configured for Chinese, Japanese or Korean. In such a setup the box edges double in width while spaces and Latin letters do not, so the right side of every box drifts. If your readers may use a CJK locale, or the target is strict ASCII, draw with +, - and |, which are always narrow. (Character classes checked against EastAsianWidth.txt from Unicode 18.0.0 on October 12, 2026.)
Frequently Asked Questions
What characters are used in ASCII diagrams?
Will ASCII diagrams render in GitHub README files?
What is the maximum width for ASCII diagrams?
- [1]Unicode Standard Annex #11: East Asian Width ↗
- [2]Unicode Character Database: EastAsianWidth.txt (18.0.0) ↗
- [3]Unicode code chart: Box Drawing, U+2500–U+257F ↗
- [4]GitHub Docs: Creating diagrams (Mermaid) ↗
- [5]GitHub Blog: Include diagrams in your Markdown files with Mermaid (February 2022) ↗
- [6]GitHub Docs: Creating and highlighting code blocks ↗