# Free online code formatters and minifiers

Format or minify HTML, CSS and JavaScript in your browser: readable code for editing, small files for production. Free, nothing is uploaded.

On the web at https://lobsite.com/tools/code

## Every formatter and minifier

- [HTML Formatter](https://lobsite.com/tools/html-formatter): Indent messy or minified HTML so it's readable again.
- [HTML Minifier](https://lobsite.com/tools/html-minifier): Strip whitespace and comments; inline CSS and JS too.
- [CSS Formatter](https://lobsite.com/tools/css-formatter): One property per line, indented the way you like.
- [CSS Minifier](https://lobsite.com/tools/css-minifier): Shorter values, merged rules, no whitespace.
- [JavaScript Formatter](https://lobsite.com/tools/js-formatter): Make minified or messy JavaScript readable.
- [JavaScript Minifier](https://lobsite.com/tools/js-minifier): Terser in your browser: shorter names, no dead code.

## Format or minify code in 3 steps

1. **Pick the tool.** HTML, CSS or JavaScript; a formatter to read code, a minifier to ship it.
2. **Paste your code.** Or open a file, or start from the sample. The result appears as you type.
3. **Copy or download it.** Minifiers show the size before and after.

## Which formatter or minifier do I need?

| | Format | Minify |
| --- | --- | --- |
| HTML | [HTML Formatter](https://lobsite.com/tools/html-formatter) | [HTML Minifier](https://lobsite.com/tools/html-minifier) |
| CSS | [CSS Formatter](https://lobsite.com/tools/css-formatter) | [CSS Minifier](https://lobsite.com/tools/css-minifier) |
| JavaScript | [JavaScript Formatter](https://lobsite.com/tools/js-formatter) | [JavaScript Minifier](https://lobsite.com/tools/js-minifier) |

## Format or minify: which one?

**Format** when you need to read code: a minified file you want to debug, a page an AI assistant squashed onto one line, or a stylesheet with no consistent indentation. Formatting changes only whitespace, so the code still works the same.

**Minify** before you publish: removing whitespace and comments, and shortening names and values, makes files smaller so pages load faster. Keep the readable version as your source and minify a copy.

## Minifying a whole site

The tools here work on one file at a time. For a whole site, a build tool like [Vite](https://lobsite.com/hosting/vite) minifies everything on each build. Lobsite, like most hosts, already compresses files with gzip or Brotli on the way to the visitor, so minifying matters most for large scripts and stylesheets.

## Code formatter and minifier FAQ

### Is my code uploaded?

No. Every formatter and minifier runs in your browser; your code never leaves it.

### Which libraries do they use?

Well-known open-source ones, running in your browser: js-beautify for the formatters, Terser for JavaScript, csso for CSS, and html-minifier-terser for HTML.

### Can minifying break my code?

Rarely, and the minifiers only make changes that keep the behaviour the same. Test the minified version before you publish it, and keep the original.

### Are they free?

Yes, with no account and no limit on use.

