HTML, CSS and JavaScript beautifier
Paste HTML, CSS or JavaScript, or open a file. Beautify lays the code out with the indent you pick. Minify shrinks JavaScript, HTML and CSS so a page can ship a smaller file.
- Format or minify
- Free, no sign-up
Runs in your browser. Nothing you type or open is uploaded. Free to use, no account. More code and data tools
How to use it
- Paste the code or open an HTML, CSS or JavaScript file.
- Choose the language, or leave Detect on, and pick 2 or 4 spaces.
- Press Beautify or Minify, then copy or download the result.
What the two buttons change
Beautify indents blocks and breaks long lines while the code keeps doing the same thing. The indent is 2 or 4 spaces, and lines wrap near 100 characters.
Minify removes comments and spare space. JavaScript is minified with Terser, which also shortens local names. HTML and CSS keep the text inside strings, and the contents of script, style, pre and textarea blocks. A syntax error is shown under the box, and your original stays in the first box.
Private by design
Privacy
Everything runs in this page and stays on your device. Pasted code is kept in this tab, so a reload brings it back, and closing the tab clears it.
This page also shows Google ads, which can use cookies. Privacy and cookies explains how.
Questions
Which languages can I format?
HTML, CSS and JavaScript. Detect reads the shape of what you pasted. A file extension sets the language when you open a file.
Does minify change what the code does?
It is meant to keep the same behaviour. JavaScript local names get shorter. Check the result if the code depends on the exact names of locals, or if it is already minified.
Will a style block inside HTML be minified on its own?
Minify HTML leaves the inside of script, style, pre and textarea as you wrote it, so a style block stays readable. Choose CSS if you want that block tightened by itself.
How large a file can I open?
A few megabytes is comfortable on a computer. The limit is the memory of the tab.
Where does the code go?
It stays in this tab. A reload keeps it, and closing the tab clears it.