Code Formatter

Beautify or minify HTML, CSS and JavaScript instantly — every transformation runs in your browser.

idle
0
Input chars
0
Output chars
0%
Saved (minify)
0ms
Run time
How each formatter works
HTML formatRe-indents tags, preserves <pre>, <textarea>, <script> and <style> contents, keeps inline text tight. HTML minifyCollapses whitespace between tags, removes HTML comments (keeps conditional <!--[if IE]>), preserves preformatted content. CSS formatSplits selectors onto their own line, indents declarations and preserves comments. CSS minifyStrips comments and unnecessary whitespace, removes the last semicolon before each }. JS formatPowered by Prettier 3.3 — the industry-standard formatter used by Webpack, Vite, Rollup and every major editor. JS minifyPowered by Terser 5 — the JS minifier shipped in Webpack/Vite/Rollup; mangles identifiers and keeps /*! license */ comments.

What is this code formatter?

This is a free, browser-based code formatter that beautifies and minifies HTML, CSS and JavaScript instantly using Prettier and Terser — with zero data leaving your device, because every parse, format and minify operation runs in JavaScript on your own machine.

How do I format HTML, CSS or JavaScript online without uploading it?

Paste your code, pick a language tab, and click Run. The tool instantly reformats with Prettier's official rules or minifies with Terser, all in your browser — nothing is uploaded.

Key features

Prettier-powered formatting
Beautifies HTML, CSS, SCSS and JavaScript using the official Prettier parsers — same output you get in VS Code.
Terser-based minification
Compresses JavaScript with mangle + dead-code elimination so production payloads are as small as possible.
Side-by-side preview
Input and output are visible at the same time and you can swap them with one click for round-trip editing.
100% client-side
Prettier and Terser are loaded as ESM bundles directly in your browser. Your code is never sent to a server.

How to use it

Paste or type your code into the input panel and choose HTML, CSS or JavaScript. Click Run to format with Prettier, or use the Minify option for JavaScript. Copy the result, download it as a file, or swap input/output for a second pass.

Frequently asked questions

Does it support modern syntax?

Yes. The JavaScript parser is the latest Prettier + Terser, which understand ES2024 features including optional chaining, top-level await, class fields and the Stage 3 pipeline.

Is my code uploaded?

No. Everything runs locally in the browser; the page never sends your source to any server.

Can I customise indent width or line length?

Yes. You can switch between 2-space, 4-space and tab indentation, and override Prettier's default print width.

Toolbox uses the official Prettier parsers (babel, estree, html, postcss) and Terser bundles published to npm, so the output matches the reference implementations developers already trust in their editor and build pipeline.