# HTML Formatter / Minifier

> Free HTML formatter that beautifies messy HTML with 2 or 4 space indents, or minifies it by removing comments and whitespace. Runs in your browser.

- Page: https://mondaytool.com/tools/html-formatter
- Category: developer-tools
- Price: free, no sign-up. Most tools run in the browser, so input is not uploaded.
- Use it: open https://mondaytool.com/tools/html-formatter. It is an interactive web page; this file is its documentation.

Last updated: 13 October 2026

## Beautify or minify HTML

This **free HTML formatter** has two modes. **Beautify** puts each tag on its own line with clear indentation, which makes minified or messy HTML readable. **Minify** does the opposite and removes comments and extra whitespace to make the file smaller. Processing runs in your browser.

## How to use it

1. Paste your HTML into the HTML Input box. A sample page is loaded to start with.
2. Choose **Beautify** or **Minify**.
3. In Beautify mode, pick an indent of 2 or 4 spaces.
4. Click **Beautify HTML** or **Minify HTML**.
5. Check the line counts and click **Copy** to copy the output.

## How it works

**Beautify** reads the HTML from left to right:

- Each opening tag goes on a new line and increases the indent by one level.
- Each closing tag reduces the indent by one level.
- Void elements such as `img`, `br`, `meta`, `link` and `input`, and tags ending in `/>`, do not change the indent.
- Comments and the DOCTYPE are kept on their own lines.
- The content of `script` and `style` tags is kept, with each line trimmed and indented one level deeper.

Example: `Home` with a 2-space indent becomes:

```

- Home

```

**Minify** removes HTML comments, removes whitespace between tags, collapses runs of spaces, and joins all lines into one.

## Limitations

- Inline tags such as `strong` and `a` are also put on separate lines, which can add visible spaces between words.
- Tags left open, such as a `

` or `` without a closing tag, push the indent too far to the right. - Whitespace inside `pre` and `textarea` is not preserved. - The formatter does not validate HTML or report errors in your markup. ## Frequently asked questions ### Is this HTML formatter free? Yes. There is no sign-up and no limit on how often you use it.

### Is my HTML sent anywhere?

No. Formatting and minifying happen in your browser and the output is not saved.
