ANSI Art from Image Generator
Convert any image to ANSI/ASCII art. Adjust width, character set, color mode, and inversion. Download as text or copy to clipboard instantly.
About
ANSI art maps pixel luminance to a ranked character ramp. Each cell in the output grid represents a block of pixels whose average brightness L is quantized into one of n printable glyphs ordered by visual density. Get the aspect correction wrong and faces stretch beyond recognition. Use a cell ratio factor near 0.5 because monospaced characters are roughly twice as tall as they are wide. This tool processes images entirely in your browser using the Canvas API. No data leaves your device. Results approximate the source image under the constraint of a fixed-width character grid. Fine detail below the cell resolution is lost to averaging.
Color ANSI output embeds per-character RGB values sampled from each cell's dominant color. This is useful for terminal emulators and HTML display but produces larger files. For plain-text contexts (README files, code comments, forum posts), grayscale mode with a high-contrast ramp yields the most legible results. Note: photographic images with smooth gradients convert better than vector graphics with hard edges unless you enable the edge-detection (Sobel) mode.
Formulas
Each pixel block is reduced to a single luminance value using the ITU-R BT.601 weighted sum:
where R, G, B are the average red, green, and blue channel values within that cell (range 0 - 255).
The luminance is normalized and mapped to a character index:
where n is the length of the character ramp. When inversion is enabled, L is replaced by 255 โ L.
Output row count is derived from the aspect-corrected dimensions:
where cols is the desired output width in characters, h and w are the source image dimensions, and r is the cell aspect ratio (typically 0.5).
For edge detection mode, the Sobel operator computes gradient magnitude:
where Gx and Gy are the horizontal and vertical convolution results of the 3ร3 Sobel kernels applied to the luminance grid.
Reference Data
| Character | Approximate Density | Best For |
|---|---|---|
| (space) | 0% | Brightest regions / background |
| . | 10% | Highlights, skin tones |
| : | 20% | Light midtones |
| - | 28% | Soft gradients |
| = | 36% | Mid-gray surfaces |
| + | 44% | Textures, fabric |
| * | 52% | Medium shadows |
| # | 65% | Dark areas, hair |
| % | 80% | Deep shadows |
| @ | 95% | Darkest regions, outlines |
| Extended Ramp (70 chars) | ||
.'`^",:;Il!i><~+_-?][}{1)(|\/tfjrxnuvczXYUJCLQ0OZmwqpdbkhao*#MW&8%B@$ | ||
| Common Output Widths | ||
| 40 cols | Low detail | Thumbnails, avatars, emoji-scale |
| 80 cols | Standard | Terminal default, code comments |
| 120 cols | High detail | Wide terminals, print |
| 160 cols | Very high | Large displays, posters |
| 200 cols | Maximum | Full-resolution art prints |
| Cell Aspect Ratios by Font | ||
| Courier New | 0.42 | Narrow cells, slight vertical stretch |
| Consolas | 0.48 | Near-ideal ratio |
| Monaco | 0.50 | Balanced square-ish mapping |
| Fira Code | 0.50 | Modern monospace, good density spread |
| Source Code Pro | 0.52 | Slightly wide, good for dense ramps |