ASCII to Image Converter
Convert ASCII art and plain text to high-resolution PNG, JPEG, or WebP images with custom fonts, colors, padding, and live preview.
About
ASCII art loses fidelity when pasted across platforms. Character grids depend on monospace rendering, and a single font substitution collapses alignment. This tool rasterizes raw text onto an HTML Canvas at pixel-level precision, preserving every space, tab, and line break as a fixed bitmap. You control the typeface, the cell size via fontSize, foreground and background colors, and padding p in pixels. Output resolution scales at 2× device pixel ratio for retina clarity. The converter handles up to 50,000 characters and exports lossless PNG, lossy JPEG (with adjustable quality q ∈ [0.1, 1.0]), or WebP.
Approximation note: glyph metrics are measured via CanvasRenderingContext2D.measureText(), which may differ from browser text layout by ±1px on certain ligature-heavy fonts. For pixel-perfect ASCII art, use a strict monospace face such as Courier New or Consolas. Tab characters are expanded to 4 spaces internally to avoid inconsistent tab-stop widths across rendering engines.
Formulas
The canvas dimensions are computed from text metrics before any pixels are drawn. Each line of input is measured individually to find the widest span.
where wlinei = ctx.measureText(linei).width in pixels, n is total line count, p is padding in px, and lineHeight is a unitless multiplier (default 1.4).
The vertical offset for the i-th line of text:
The 0.8 factor approximates the ascent ratio for Latin glyphs, aligning baselines correctly. For retina output, all coordinates are multiplied by the device pixel ratio dpr = 2, while CSS dimensions remain at 1×.
Reference Data
| Font Family | Type | Monospace | Recommended For | Platform Availability |
|---|---|---|---|---|
| Courier New | Serif Mono | Yes | Classic ASCII art | Windows, macOS, Linux |
| Consolas | Sans Mono | Yes | Code & box-drawing chars | Windows (bundled) |
| Monaco | Sans Mono | Yes | Compact ASCII | macOS (bundled) |
| Menlo | Sans Mono | Yes | Terminal output | macOS (bundled) |
| Liberation Mono | Sans Mono | Yes | Linux default mono | Linux (bundled) |
| Lucida Console | Sans Mono | Yes | Legacy Windows art | Windows (bundled) |
| Source Code Pro | Sans Mono | Yes | Modern ASCII, wide glyphs | Adobe (free, web) |
| DejaVu Sans Mono | Sans Mono | Yes | Unicode box-drawing | Linux (bundled) |
| Fira Code | Sans Mono | Yes | Ligature-aware art | Google Fonts (free) |
| monospace (generic) | System | Yes | Fallback safe option | All platforms |
| Arial | Sans | No | Proportional text banners | All platforms |
| Georgia | Serif | No | Elegant text renders | All platforms |
| Verdana | Sans | No | High-readability text | All platforms |
| Times New Roman | Serif | No | Document-style output | All platforms |
| Impact | Sans | No | Bold headlines & memes | Windows, macOS |