Code Formatter
Format and minify JSON, CSS, HTML and JavaScript.
Designed to run in your browser. See the privacy policy.
About Code Formatter
This code formatter beautifies or minifies four languages: JSON, CSS, HTML/XML and JavaScript. Paste your source, pick the language and mode, and the formatted result appears straight away with a character count showing how much it grew or shrank. You can copy it or download it as a file with the right extension.
It is a quick way to make a minified stylesheet readable, tidy a messy HTML snippet, or squeeze a small script before pasting it somewhere. Formatting runs in your browser.
Be aware of how each language is handled. JSON is fully parsed and re-serialised, so invalid JSON shows an error. CSS, HTML/XML and JavaScript use lightweight best-effort formatters rather than a full parser: JavaScript formatting is heuristic and can lay out complex one-liners imperfectly, minifying JavaScript only removes comments and whitespace (it does not rename variables), and CSS comments are dropped.
How to use
- Choose a Language: JSON, CSS, HTML/XML or JavaScript.
- Pick Beautify to indent the code or Minify to strip whitespace and comments.
- For Beautify, choose an Indent of 2 spaces, 4 spaces or Tab.
- Paste your code into the source panel.
- Copy the formatted output or download it as a file.