ANSI Color Previewer

Paste terminal output with ANSI escape codes and see it rendered in colour, or build SGR sequences to copy.

Escapes may be written as \e, \033, \x1b, \u001b, ^[ or a real ESC byte.

Rendered preview

 

Escape sequences found

    SGR escape code builder

    Attributes
     

      SGR quick reference (ECMA-48 / ISO 6429)
      0
      reset every attribute
      1 2 22
      bold, dim, back to normal intensity
      3 4 9
      italic, underline, crossed out
      5 7 8
      blink, reverse video, conceal
      30 to 37
      foreground black, red, green, yellow, blue, magenta, cyan, white
      90 to 97
      the same eight foregrounds, bright
      40-47 / 100-107
      the same colours as background
      39 49
      back to the default foreground / background
      38;5;n
      foreground from the 256-colour palette (48;5;n for background)
      38;2;r;g;b
      24-bit true-colour foreground (48;2;r;g;b for background)

      The 256-colour palette is xterm's: 0 to 15 are the basic colours, 16 to 231 form a 6x6x6 cube at index 16 + 36r + 6g + b with the levels 0, 95, 135, 175, 215 and 255, and 232 to 255 are a 24-step grey ramp at 8 + 10 * (n - 232).

      No uploads. Your files stay on your device.

      Free forever, no sign-up, no cookies. Buy me a coffee

      How it works

      Paste anything a terminal printed, such as a CI log, ls --color output or a snippet of source code, and this page renders it the way your terminal would. It reads the SGR (Select Graphic Rendition) escape sequences defined in ECMA-48 / ISO 6429: CSI n m, where CSI is ESC [. Bold, dim, italic, underline, blink, reverse and conceal are supported, along with the 8 basic and 8 bright colours, the xterm 256-colour palette (38;5;n) and 24-bit true colour (38;2;r;g;b). The colon-separated form from ITU-T T.416 (38:2::r:g:b) is accepted too. Cursor movement, erase and OSC sequences are recognised and skipped rather than printed as junk.

      Escape bytes rarely survive a copy and paste, so the input also accepts the usual written forms: \e, \033, \x1b, \u001b and the caret notation ^[. Every sequence found is listed under the preview with what it actually does, which makes it easy to spot the missing \e[0m that is bleeding colour into the rest of your log. The builder goes the other way: pick colours and attributes, then copy the finished sequence in Bash, printf, C/JavaScript or Java/JSON notation.

      Terminals disagree about what "red" looks like, so the exact colours follow the palette you pick: xterm, VS Code Dark+ or Ubuntu/GNOME. That is also why the preview itself is not held to a contrast standard, since it reproduces the colours your program asked for whether they are readable or not. Everything runs 100% in your browser, with no uploads and no sign-up, so pasting a production log here is safe.

      Frequently asked questions

      Which ANSI escape codes does the previewer support?

      It renders the SGR (Select Graphic Rendition) sequences defined in ECMA-48 / ISO 6429: bold, dim, italic, underline, blink, reverse, conceal and strikethrough, the 8 basic and 8 bright colours, the xterm 256-colour palette via 38;5;n and 48;5;n, and 24-bit true colour via 38;2;r;g;b. The colon-separated form from ITU-T T.416, such as 38:2::18:52:86, is accepted too. Cursor movement, erase and OSC sequences are recognised and skipped rather than printed as junk.

      My log lost its escape characters when I copied it. Can I still preview it?

      Yes. Raw ESC bytes rarely survive a copy and paste, so the input also accepts the written forms you see in source code: \e, \033, \x1b,  and the caret notation ^[. All of them are converted to real escape bytes before rendering, so pasting a snippet straight out of a shell script or a JavaScript file works without editing it first.

      Why do the colours look different from my own terminal?

      Terminals do not agree on what the 16 basic colours look like, so the same code renders differently in xterm, VS Code and GNOME Terminal. Pick the palette that matches your setup from the dropdown above the preview. The 256-colour palette and 24-bit true colour are fixed by the xterm formulas, so those match everywhere: indexes 16 to 231 form a 6x6x6 cube and 232 to 255 are a 24-step grey ramp.

      Report a bug