How to use the HTML Formatter
- Paste your HTML into the left box, or open a file.
- Adjust the options if you need to.
- Copy the formatted HTML or download it as a file.
What does this tool do?
Formatting uses the open-source js-beautify engine, loaded only on this page. Inline CSS and JavaScript inside the HTML are formatted too. Your code is only re-printed, never run.
Why use it?
- Read minified page source.
- Tidy templates and emails.
- Quick minification for small snippets.
Tip
For production sites, let your build tool minify HTML automatically. This tool is best for one-off snippets and debugging.
Privacy
Everything you type is processed in your browser. Nothing you enter is sent to our servers or stored by us. There's no account to create and nothing to install.
Frequently asked questions
Can minifying HTML break my page?
Rarely, but whitespace between inline elements (like links or buttons side by side) can be visible, and removing it can change spacing slightly. Check the page after minifying; content inside <pre> tags should keep its spacing.
Is my HTML run or loaded when I format it?
No. The code is only re-printed as text. Scripts aren't executed and images or other resources aren't loaded.
Last reviewed by the M2Toolkit team.