Skip to content
I Hate Online Tools

Minify / beautify

Minify or pretty-print HTML, CSS, or JavaScript without a network round-trip.

Runs in this tab. The file stays here.

This runs in your browser. Nothing is uploaded.

About Minify / beautify

Minifies or pretty-prints HTML, CSS, and JavaScript in your browser without sending your source to an online formatter.

Minifiers and beautifiers on the internet are convenient until the snippet is a proprietary widget, a licensed stylesheet, or a bundle you cannot put on someone else's disk. I wanted the three formats I actually paste in a hurry: HTML, CSS, and JavaScript. Pick a mode, pick minify or beautify, paste. HTML and CSS minify are conservative whitespace and comment passes in the tab. JavaScript uses terser. Nothing phones home with your source. Turn the network off after load and the buttons still work, which is the whole privacy story.

Beautify uses js-beautify with two-space indent and a newline at the end, the same defaults I reach for when a minified file lands in chat and I need to read it. Minify won't fix broken syntax. Invalid JavaScript returns terser's error. I didn't add TypeScript, JSX, JSON, or YAML here; those have their own pages or their own parsers, and pretending one button covers every language is how formatters lie. JSON belongs on the JSON formatter; YAML belongs on the YAML converter. Switch modes before you paste if you changed languages mid-task; the button labels are explicit so you do not minify CSS with the HTML pass by mistake.

HTML minify is not a security sanitizer and not a template engine. It removes HTML comments and squeezes whitespace between tags; it won't rewrite your DOM for accessibility or strip scripts you left in on purpose. JavaScript minify keeps names unmangled by default so a quick shrink is readable enough to diff. If you need aggressive mangle and dead-code elimination for production, run your real build tool. This is the in-tab tidy pass before a paste or a quick size check. Pair with text diff if you want to see what minify changed besides fewer spaces. Load a file from disk if you prefer; the source still never uploads.

How to use Minify / beautify

  1. 1Choose HTML, CSS, or JavaScript, then Minify or Beautify.
  2. 2Paste the source into the input panel.
  3. 3Copy the output, or read the error if the parser rejected the input.

What it won't do

  • HTML, CSS, and JavaScript only. No TS, JSX, JSON, or YAML.
  • HTML minify is whitespace-level, not a semantic HTML optimizer.

Common questions

Which languages does minify beautify support?

HTML, CSS, and JavaScript only. Not TypeScript, not JSX, not JSON, not SCSS. Paste those through a compiler or the JSON formatter first if you need a string this page can understand.

How is HTML minify implemented?

A whitespace and comment pass: strip HTML comments, collapse space between tags, trim runs of spaces. It is not a full HTML parser rewrite. Weird malformed markup may minify into something browsers still forgive but you should eyeball.

Does JavaScript minify mangle variable names?

Not by default here. Terser runs with mangle off so a quick minify is still somewhat readable and less surprising when you diff output. Turn to your bundler when you need production-grade shrinking.

Related tools

Why this one doesn't upload your file

There is no server to upload to. This page is a static file, and the work happens in your browser using the same graphics and WebAssembly code that renders every other site you visit. Your file is read from disk into memory, processed, and handed back as a download. Once the page has loaded you can disconnect from the network entirely and it keeps working. The longer explanation

Install the app