# HTML formatter

Format and beautify messy HTML in your browser, including minified markup. Void tags and inline scripts are handled properly. Nothing is uploaded.

Canonical page: https://filetity.com/html-formatter

## Capabilities

- Free: Yes, with no watermark and no page limit.
- Account required: No. There is no account system.
- Processed on device: Yes. The file is read by your browser and never uploaded. There is no server to send it to.
- Formats: HTML in, including minified. Formatted HTML out, or minified back down.
- Limits: Formats the markup you give it and does not rewrite it. It will not close your unclosed tags or correct invalid nesting.
- Mobile: Yes, on any modern mobile browser. Large files are limited by the memory the phone gives the browser.
- Offline: Yes, after you have used it once. Your browser keeps what the tool needs, so it then works with no network connection.

## Questions

### Will it fix my broken HTML?

No, and that is on purpose. It formats what you give it rather than guessing at what you meant, because a formatter that silently adds closing tags can change how the page renders while looking like it only changed the whitespace.

### Does it handle minified HTML from a built site?

Yes. That is the main reason people open one. Paste the whole thing in and it comes back with one element per line and real indentation.

### What happens to my inline JavaScript and CSS?

It is passed through untouched. The contents of script and style are treated as text, not markup, so nothing inside them is reindented or misread as a tag.

### Why does <br> not get a closing tag?

Because in HTML it never has one. br, img, input, meta and the rest of the void elements are complete on their own. Adding a closing tag would be invalid HTML, so the formatter leaves them as they are.

### Why does a short element like <title>Home</title> stay on one line?

Because splitting it across three lines would add whitespace inside the element, and in HTML a browser renders that whitespace. An element holding nothing but text is kept on its line, and so is an empty pair like <p></p>; one with child elements is opened up.

## Related tools

- [XML formatter](https://filetity.com/xml-formatter): Format, beautify and validate XML, with real error positions.
- [JSON Formatter and Validator](https://filetity.com/json-formatter): Format, beautify, validate and read JSON, and find the line that broke it.
- [URL Decoder and Encoder](https://filetity.com/url-decoder): Turn %20 and %C3%A9 back into readable text, or encode text for a URL.
