Pretty print for reading
Pretty printing means laying code out so that a person can read it. This page does that and then shows the result like a code editor would, with a line number on each line and colors for keywords, strings, numbers, comments and regular expressions. It is made for reading and checking code, rather than for editing it.
The colors
- Keywords such as function, return, const and if.
- Strings and template literals.
- Numbers.
- Regular expressions.
- Comments.
When it helps
- You copied a script from a web page or a network response and it is one long line.
- You need to point to a line, for example in a bug report or code review.
- You want to check what a snippet does before you run it.
Copying the code
The Copy result button copies plain text without the line numbers, so you can paste it straight into your editor. Download gives you a .js file. For very long code, the display shows the first 4000 lines and a note, but copy and download always include everything.
Same engine, different view
The layout comes from the same engine as the JavaScript formatter, so all of its options are here too: indent, line breaks, blank lines, object layout and quotes. Heavily compressed code reads best with the beautifier settings. If you only want smaller files, see the JavaScript minifier.