Pretty-print or minify HTML, CSS and JavaScript in your browser with js-beautify and Terser. Nothing is uploaded.
Beautifying uses js-beautify; JavaScript minifying uses Terser. Both load from a public CDN in your browser. Nothing is uploaded.
What the code formatter does
Paste HTML, CSS or JavaScript and choose Beautify to pretty-print it with consistent indentation, or Minify to strip comments and whitespace. JavaScript minifying runs Terser; HTML and CSS formatting runs js-beautify. Everything happens in the page.
Frequently asked questions
Is my code uploaded?
No. The libraries load in your browser and the code never leaves the tab.
Why is there a small delay before minify?
The minifier is a larger script that loads from a CDN the first time you open the tool. Beautify is available immediately.
Does minifying change behaviour?
Minifying removes whitespace and comments but keeps the code equivalent. For JavaScript it is safe for normal code; extremely unusual syntax edge cases are rare.
How to use it
- Paste your code into the first input field labeled “Paste code here…”.
- Select the matching language option — html, css, or js — from the options provided.
- Click Beautify to indent the code with consistent formatting, or click Minify to remove whitespace and comments.
- Copy the result from the second input field labeled “Output appears here…”.
Where it comes in handy
A developer receives a 15,000-character minified JavaScript bundle from a build process and needs to inspect a single function. Pasting it into the minified output reveals the structure in readable form within seconds, without needing a build environment.
A frontend engineer pastes a 4,200-line CSS stylesheet copied from a production page. The inconsistent indentation makes locating a specific rule tedious. Running beautify reorganises the file with two-space indentation and consistent nesting, cutting search time from minutes to under ten seconds.
A developer preparing assets for a production deploy wants to shrink a 12 kilobyte HTML template. Selecting js and clicking minify strips all unnecessary whitespace and comments, reducing the file to approximately 9.6 kilobytes before it is served to users.
Worth knowing
- JavaScript minification loads Terser from a CDN only on the first use in a browser session, causing a noticeable delay before the first minify request completes. Subsequent attempts in the same tab are faster because the script is cached locally.
- js-beautify normalises indentation to two spaces for HTML and CSS by default. Code that relied on existing whitespace for layout, such as inline spans separated by spaces, may render differently after beautification.
- The tool processes only one language at a time. Pasting mixed HTML with embedded CSS and JavaScript blocks will not be reformatted correctly for all sections simultaneously — each block must be handled separately.