Dev

Code Formatter & Minifier

Paste messy or minified code — get it cleanly formatted with Prettier, or squeezed down to the smallest size.

Paste code to begin
Input —
or drop a file here
Mode
Output —
Formatted code will appear here
Settings 2 spaces · 80 cols · double quotes
How It Works

How to Use Code Formatter & Minifier in 3 Steps

1

Paste or open code

Paste a snippet or drop a file. The language is detected automatically — pick it yourself for SCSS, Markdown or YAML, or if the guess is wrong.

2

Beautify or minify

Beautify re-indents with Prettier (the formatter most teams use). Minify strips whitespace and comments — and for JavaScript, shortens names with Terser.

3

Copy or download

The output updates as you type. Copy it, or download it with the right file extension. The badge shows how many bytes you saved.

FAQ

Code Formatter & Minifier — Frequently Asked Questions

Which tools does it use?

Beautify uses Prettier for HTML, CSS, SCSS, JS, TS, Markdown and YAML, and sql-formatter for SQL. Minify uses Terser for JavaScript and CSSO for CSS. JSON uses the browser’s own JSON engine; XML and HTML minify are built in.

Is minified JavaScript safe to use?

Yes — Terser only applies transformations that keep behaviour identical. Turn off “Shorten variable names” if other scripts call your functions by name, and leave console calls in while debugging.

What does HTML minify remove?

Comments and the whitespace between block-level tags (div, p, li, table…). Spaces between inline elements are kept so text doesn’t run together, and the contents of <pre>, <textarea>, <script> and <style> are left exactly as they are.

Why can’t I minify TypeScript, SCSS or Markdown?

They are source formats that get compiled first — minify the compiled JavaScript or CSS instead. Beautify works for all of them.

Why do I see “Loading formatter…”?

Each formatter downloads once, the first time you use that language (Prettier’s TypeScript support is the biggest at about 1 MB). After that it is cached by your browser and formatting is instant.

Is my code uploaded anywhere?

No. Formatting and minifying run in JavaScript inside your browser tab. The formatter libraries are downloaded once from a CDN; your code never leaves the page.