User Rating 0.0
Total Usage 0 times
Type a character
0, 0Pencil80×24
Is this tool helpful?

Your feedback helps us improve.

About

ANSI art encodes visual information within the constraints of monospaced character grids and a fixed 16-color palette defined by ECMA-48 / ISO 6429. A single misplaced escape sequence renders the entire downstream output as garbage in most terminal emulators. This editor operates on a cols × rows grid where each cell stores a character, a foreground color index, and a background color index. It implements Bresenham's line algorithm for precise diagonal strokes and iterative BFS flood fill to avoid recursion limits on large canvases. Export produces optimized ANSI escape sequences that only emit color-change codes when the palette actually shifts between adjacent cells, reducing output size by roughly 40% compared to naive per-cell encoding.

The tool assumes a standard 80×24 terminal geometry by default. Grids exceeding 200 columns may render incorrectly in terminals that do not support line wrapping suppression. Box-drawing characters (U+2500 block) require a font with complete Unicode coverage. Pro tip: test your exported art in at least two terminal emulators - rendering of block elements like and varies between xterm, iTerm2, and Windows Terminal.

ansi art ascii art text art editor ansi escape codes box drawing characters terminal art character art generator

Formulas

The line tool uses Bresenham's algorithm to determine which grid cells to fill between two endpoints. Given start cell (x0, y0) and end cell (x1, y1):

dx = |x1 x0|
dy = |y1 y0|
err = dx + dy

At each step, the error term err is tested. If 2err dy, advance horizontally and add dy to err. If 2err dx, advance vertically and add dx to err. This yields an integer-only, branch-minimal rasterization with O(max(dx, |dy|)) time complexity.

ANSI export uses SGR (Select Graphic Rendition) sequences:

ESC[38;5;fgm - set foreground to color index fg
ESC[48;5;bgm - set background to color index bg
ESC[0m - reset all attributes

Where fg and bg are integers 0 - 15 corresponding to the standard ANSI color indices. The optimizer tracks the previous cell's colors and only emits a new SGR sequence when either fg or bg differs from the predecessor, reducing byte count significantly for regions of uniform color.

Reference Data

CharacterUnicodeNameUsage
U+2500Box Light HorizontalHorizontal lines
U+2502Box Light VerticalVertical lines
U+250CBox Light Down RightTop-left corner
U+2510Box Light Down LeftTop-right corner
U+2514Box Light Up RightBottom-left corner
U+2518Box Light Up LeftBottom-right corner
U+251CBox Light Vertical RightLeft T-junction
U+2524Box Light Vertical LeftRight T-junction
U+252CBox Light Down HorizontalTop T-junction
U+2534Box Light Up HorizontalBottom T-junction
U+253CBox Light Vertical HorizontalCross junction
U+2550Box Double HorizontalDouble horizontal line
U+2551Box Double VerticalDouble vertical line
U+2554Box Double Down RightDouble top-left corner
U+2557Box Double Down LeftDouble top-right corner
U+255ABox Double Up RightDouble bottom-left corner
U+255DBox Double Up LeftDouble bottom-right corner
U+2588Full BlockSolid fill, pixel art
U+2593Dark Shade75% density shading
U+2592Medium Shade50% density shading
U+2591Light Shade25% density shading
U+2584Lower Half BlockSub-cell vertical resolution
U+2580Upper Half BlockSub-cell vertical resolution
U+258CLeft Half BlockSub-cell horizontal resolution
U+2590Right Half BlockSub-cell horizontal resolution
U+25CFBlack CircleDecorative, bullets
U+25CBWhite CircleDecorative, status indicators
U+2666Black DiamondDecorative elements
U+2605Black StarRating, decoration
U+2660Black SpadeCard art, decoration
U+2665Black HeartCard art, decoration

Frequently Asked Questions

The exported sequences use the 256-color SGR format (ESC[38;5;Xm / ESC[48;5;Xm) which is supported by xterm, iTerm2, GNOME Terminal, Windows Terminal, and most modern emulators. Older terminals like the native Windows cmd.exe prior to Windows 10 version 1511 do not support these codes. The plain text export strips all escape sequences for maximum compatibility.
Box-drawing characters reside in the Unicode U+2500 - U+257F block. Your terminal's font must include these glyphs. Monospace fonts with full coverage include DejaVu Sans Mono, Consolas, Fira Code, and JetBrains Mono. If your terminal defaults to a bitmap font without these codepoints, the characters render as replacement glyphs.
The implementation uses iterative breadth-first search (BFS) with an explicit queue rather than recursive depth-first search. Recursive flood fill on an 80×24 grid (1,920 cells) risks hitting JavaScript's call stack limit (~10,000-25,000 frames depending on the engine). The BFS approach uses heap memory for the queue, which is limited only by available RAM - easily handling grids up to 200×100 (20,000 cells).
The plain text export works directly with any system that supports Unicode text. For IRC specifically, you would need mIRC color codes (Ctrl+K format) rather than ANSI escape sequences - this editor produces ANSI/VT100 sequences designed for terminal emulators. BBS systems using ANSI.SYS (such as Synchronet or Mystic BBS) are fully compatible with the ANSI export format.
The editor supports grids up to 200 columns by 100 rows (20,000 cells). Canvas rendering remains smooth because only dirty cells are repainted - a full redraw of 20,000 cells at 12×16 pixel cell size produces a 2400×1600 canvas, well within GPU texture limits. The undo stack stores full grid snapshots capped at 50 levels. At maximum grid size, each snapshot occupies approximately 600 KB of memory, so the full stack uses about 30 MB.
Naive encoding emits a foreground SGR sequence (7-12 bytes), a background SGR sequence (7-12 bytes), and a reset (4 bytes) for every single cell. For an 80×24 grid, that produces roughly 35-55 KB. The optimized encoder tracks the current foreground and background state and only emits new SGR codes when colors change between adjacent cells. For typical ANSI art with large uniform-colored regions, this reduces output by 40-60%, yielding files around 15-25 KB.