# HTML Formatter

> Beautify or minify HTML, including inline CSS and JavaScript. Runs entirely in your browser, so nothing is uploaded.

Source: https://toffeekit.com/tools/html-formatter

**Category:** [Developer](https://toffeekit.com/category/developer) · **Price:** Free · **Runs:** in your browser, nothing is uploaded

Open the tool: https://toffeekit.com/tools/html-formatter

**Also useful for:** html formatter, html beautifier, pretty print html, html minifier, format html, indent html, html prettify

## What you can do

- **Beautify HTML** — Indent a minified page so the structure is easy to follow. ([open with this preset](https://toffeekit.com/tools/html-formatter?preset=beautify))
- **Minify HTML** — Strip comments and spare whitespace without breaking inline text. ([open with this preset](https://toffeekit.com/tools/html-formatter?preset=minify))

## How it works

1. Paste HTML into the input, or click Open to load an .html file.
2. Choose Beautify or Minify at the top.
3. For Beautify, set Indent, Wrap lines at, Attributes and Indent inside <html>.
4. Copy or Save the result. The status line shows how much smaller minified HTML is.

## FAQ

### Does it format CSS and JavaScript inside the page?

Yes. Code inside <style> and <script> tags is beautified with the same indent settings.

### Will minifying break my page?

It is deliberately cautious. Whitespace is collapsed to one space and only removed next to block tags like <div> and <p>, so spaces between inline words and links stay. <pre> and <textarea> content is never changed.

### Are IE conditional comments kept when minifying?

Yes. Comments starting with <!--[if are kept because some email clients still read them. Other comments are removed unless you turn on Keep comments.

### What do the Attributes options mean?

Inline keeps attributes on the tag's line. One per line puts each attribute on its own line when a tag has several, and Aligned lines them up under the first attribute.

### Does it fix broken HTML?

No. It re-indents what you give it but doesn't add missing closing tags or validate the markup.

### Is HTML Formatter free and private?

Yes. It's free with no sign-up or limits, and it runs entirely in your browser, so what you type or paste never leaves your device. It works on phones and computers alike.

## Privacy

HTML Formatter runs entirely in your browser. Your files and text are processed on your device and are never uploaded.

## Related tools

- [JSON Formatter](https://toffeekit.com/tools/json-formatter) — Format, minify and validate JSON with clear errors.
- [Base64 Encode / Decode](https://toffeekit.com/tools/base64-encoder) — Encode text to Base64 or decode it back, UTF-8 safe.
- [URL Encode / Decode](https://toffeekit.com/tools/url-encoder) — Percent-encode query values or whole URLs.
- [HTML Entities](https://toffeekit.com/tools/html-entity-encoder) — Escape < > & and quotes, or decode entities.
- [JWT Decoder](https://toffeekit.com/tools/jwt-decoder) — Read a token's header, claims and expiry.
- [Hash Generator](https://toffeekit.com/tools/hash-generator) — MD5, SHA-1, SHA-256, SHA-384 and SHA-512 at once.

