Code Minifier
Minify JavaScript or CSS by stripping comments and unnecessary whitespace, safely preserving strings, template literals and regex. See the size saved instantly, all in your browser.
Smaller JavaScript and CSS
Minifying strips comments and unnecessary whitespace to shrink your file. For CSS the rules are collapsed
tightly; for JavaScript line breaks are kept where they matter so automatic semicolon insertion is not
broken. The JavaScript minifier is string-, template- and regex-aware, so anything inside quotes,
backticks or a /regex/ is preserved exactly.
Minification happens in your browser, nothing is uploaded.
What this does
A code minifier strips comments and unnecessary whitespace from JavaScript or CSS to shrink the file, and shows how much you saved.
How to use it
- Paste your JavaScript or CSS.
- Pick the language.
- Minify it.
- Copy the smaller output.
How it works
Comments and redundant whitespace are removed while strings, template literals and regex are preserved. It does not rename variables, so the result is safe and easy to verify.
Example
A commented, indented CSS rule collapses to a single compact line.
Sources & methodology
Last updated .
Frequently asked questions
What does minifying remove?
It strips comments and redundant whitespace. For CSS it collapses rules tightly; for JavaScript it keeps line breaks where they matter so automatic semicolon insertion is not broken.
Will it break my strings or regex?
No. The JavaScript minifier is string-, template- and regex-aware, so anything inside quotes, backticks or a /regex/ is left exactly as written.
Is this a full optimiser?
No. It does not rename variables or rewrite code, it only removes comments and whitespace, so the result is safe and easy to verify.
Is my code uploaded?
No. Minification happens entirely in your browser; nothing is sent anywhere.
Related tools
JSON Formatter
Pretty-print, validate and minify JSON, with selectable indentation and optional recursive key sorting. Syntax errors are pinpointed by line and column. Fast and private, all in your browser.
XML Formatter
Pretty-print XML with clean, consistent indentation. Self-closing tags and declarations are preserved, and simple text-only elements stay on one line. Instant and in-browser.
SQL Formatter
Format SQL queries for readability: keywords are uppercased and major clauses like FROM, WHERE, JOIN and ORDER BY start on new lines. String literals are left untouched. Runs in your browser.
Base64 Encoder & Decoder
Encode text to Base64 or decode Base64 back to text, with a URL-safe (base64url) option. UTF-8 aware, so emoji and accented characters round-trip perfectly. Runs in your browser.