Skip to content

Code Minifier (shrink HTML · CSS · JS · JSON)

Remove comments and unnecessary whitespace from HTML, CSS, JS and JSON to cut file size. Paste code or open a file (drag and drop works), then copy the result or download a .min file. Your code is never sent to a server.

Code and files you paste or open are processed only inside this browser and are never sent or stored. Still, close the page after use on a shared computer.

This tool only removes comments and whitespace. It does not rename variables or rewrite code, so it saves less than terser or esbuild but never changes behavior. Re-test code you ship.

How it works

  • All four languages use minifiers built for this site. Strings, regex literals, template literals and url() are left untouched; only comments and whitespace between tokens are removed.
  • For JS, whitespace that contains a line break is kept as a single line break, because automatic semicolon insertion (ASI) depends on line breaks.
  • For HTML only whitespace between block-level tags is removed; a single space between inline elements stays so words do not run together. <pre> and <textarea> are left as is, and <script> / <style> go through the JS / CSS minifier.
  • JSON loses only whitespace outside strings. It is not parsed and re-written, so big integers, 1.0 and unicode escapes stay unchanged.
  • Opening a file picks the language from the extension, and downloads are named like app.js → app.min.js.

FAQ

Is my code or file uploaded?

No. Files are only read by the browser and everything runs inside this tab.

Minifying changed how my code behaves.

Only comments and whitespace are removed, but very rare syntax (code where a regex is ambiguous) can go wrong. Please report it, and keep your original meanwhile.

Why are variable names not shortened?

Renaming needs a full parser, and a mistake silently changes behavior. This tool puts safety first. For more savings enable gzip on your server or use a build tool (terser, esbuild).

How should I manage .min files?

Keep the original and deploy only the .min file. Minified code is hard to read and edit.

How to use this tool

Use it to shrink code for deployment. It removes comments and unnecessary whitespace from HTML, CSS, JS and JSON. Paste code or drop a file, then copy the result or download a .min file. Code is not sent to a server.

Frequently asked questions

Does minifying change how the code works?

It only removes comments and unnecessary whitespace, so behavior is meant to stay the same. Run the minified result once before deploying.

Which formats are supported?

HTML, CSS, JS and JSON.

Can I get the result as a file?

Yes. Copy it or download a .min file; you can also drop a file to open it.

See all tools

Developer Tools

Forty everyday developer helpers in one place (including TOTP, semver, bit operations, .env/INI/TOML conversion, JSON Schema validation, docker run → compose, .gitignore, OG tags and ASCII/ANSI tables) (now with subnet/CIDR, chmod, an HTTP/MIME/port reference, robots/sitemap and dummy data): URL, Base64, HTML and Unicode encoding, JSON formatting, CSV and type generation, Unix time, JWT decoder, hashes, UUIDs, regex, text diff, number bases, cron, certificate/CSR and mail header readers, business registration number checks, and a table converter.

Code Formatter (Beautifier)

Tidy HTML, CSS, JS, JSON, PHP, Java, Kotlin, Shell, Python, SQL, XML and YAML with tabs or spaces (2, 4 or 8), then copy it or export it as colored HTML. Your code is never sent to the server.

JSON, XML & YAML Parser

Paste or open a JSON, XML or YAML file to validate it (with the exact line and column of any error), browse it as a collapsible tree, search values and keys, look values up by path, pretty-print or minify it, and convert between formats. Everything runs in your browser — your input and files are never sent to a server.

CSS Generator

Build gradients, shadows (box/text-shadow), rounded corners (border-radius) and flex/grid layouts while watching them, then copy the CSS. Nothing is sent to a server.

Password Generator

Create a hard-to-guess password from a length and character types, or as an easy-to-remember word combination (passphrase). The result never leaves this page.

What is my IP

Check your public IP address and approximate location.