Language
English English Vietnamese (Tiếng Việt) Vietnamese (Tiếng Việt) Chinese (简体中文) Chinese (简体中文) Portuguese (Brazil) (Português do Brasil) Portuguese (Brazil) (Português do Brasil) Spanish (Español) Spanish (Español) Indonesian (Bahasa Indonesia) Indonesian (Bahasa Indonesia)
Code Minifier

Code Minifier

Minify JavaScript, CSS, and HTML in your browser to shrink file size, with live compression stats and per-language options.

What Is the Code Minifier?

The Code Minifier compresses JavaScript, CSS, and HTML to shrink file size by stripping out comments, whitespace, and other characters a browser does not need. The code keeps working exactly the same, only smaller — so pages download faster and use less bandwidth.

It is built for front-end and web developers who want production-ready output without installing a build tool. Pick a language tab, paste your code, and the minified result appears automatically with live compression stats. JavaScript is handled by Terser, while CSS and HTML use targeted rules that preserve the parts that must stay intact.

Private by design: every minification runs in your browser. Your code is never uploaded, logged, or stored on any server.

How to Minify Your Code

1

Choose a Language

Select the JavaScript, CSS, or HTML tab at the top. Each tab loads the right engine and its own set of options.

2

Paste or Upload Code

Type or paste into the input panel on the left, or use Upload to load a file from your device. Press Sample to drop in example code for the current language.

3

Adjust Options

Tune the language-specific options in the toolbar — such as Mangle and Compress for JavaScript or Collapse whitespace for HTML. The output re-minifies as soon as you change a setting.

4

Review & Export

The result appears on the right with syntax highlighting, and the stats bar shows original size, minified size, and savings. Then Copy the output or Download it as a file.

Shortcuts: the output auto-minifies as you type after a short pause. Press Ctrl + Enter to minify immediately, or Tab in the editor to insert four spaces.

Features

JavaScript via Terser

Minify modern ES6+ code with Terser, toggling Mangle, Compress, Drop console, and Drop debugger.

CSS Minification

Remove comments, collapse whitespace, shorten hex colors, and optimize zero values while keeping calc() intact.

HTML Minification

Strip comments, collapse whitespace, and optionally remove optional closing tags and unneeded attribute quotes.

Auto-Minification

Output updates automatically as you type, with debounced processing so it never lags behind your input.

Compression Stats

See original size, minified size, and the exact percentage saved after every run.

Syntax-Highlighted Output

The minified result is highlighted with Prism.js so it stays readable instead of one dense line.

Upload & Download

Load a file straight from your device and download the minified output with the correct extension.

One-Click Copy & Samples

Copy the result to your clipboard instantly, or load built-in sample code to try each language.

100% Client-Side

All processing happens in your browser, so your code never leaves your device.

Options by Language

JavaScript

Mangle shortens local names, Compress applies dead-code elimination, and Drop console / Drop debugger strip debug statements.

CSS

Toggle Remove comments; whitespace collapsing, hex shortening, and zero-value optimization run automatically.

HTML

Toggle Remove comments, Collapse whitespace, and Remove optional tags to control how aggressively markup is trimmed.

Frequently Asked Questions

What is code minification?

Minification removes everything a browser does not need to run your code — comments, extra whitespace, and optional syntax — without changing what the code does. The result is a smaller file that loads and parses faster.

Does minifying code improve page speed?

Yes. Smaller JavaScript, CSS, and HTML files download faster and require the browser to read fewer characters, which lowers bandwidth use and helps pages become interactive sooner.

Is my code sent to a server?

No. All minification happens locally in your browser. Your code is never uploaded or stored anywhere — even proprietary source stays on your device.

Will minification break my code?

It is designed to preserve functionality. Terser renames JavaScript identifiers safely, HTML leaves the contents of pre, script, style, and textarea untouched, and CSS keeps calc() expressions intact. As with any build step, test the output and keep your original source.

What does "Mangle" mean?

Mangling shortens local variable and function names — for example myVariable becomes a — to cut file size without affecting how the code runs. It only renames identifiers that are not exposed externally.

Can I unminify code here?

No — this tool only minifies. To pretty-print or reformat minified code, use a code formatter or beautifier instead. Note that mangled JavaScript names cannot be restored to their originals, since that information is removed during minification.

How much file size can I save?

It depends on the language and coding style. JavaScript with Mangle and Compress often sees 40–70% reduction, CSS typically 20–40%, and HTML 10–30% depending on how much whitespace and how many comments are present. The stats bar shows the exact savings for your code.

What is the difference between minify and gzip?

Minification rewrites the source itself to remove unneeded characters, so the file is smaller everywhere it is read. Gzip is server-side compression applied during transfer and transparently decompressed by the browser. They stack: minify first, then let the server gzip the result for the smallest download.

Can I minify multiple files at once?

The tool processes one file at a time. After minifying, upload a new file or paste fresh code to handle the next one.

Paste code into the input panel and it auto-minifies after a short delay
Press Ctrl+Enter to minify immediately without waiting
Press Tab in the editor to insert four spaces for indentation
Click Sample to load example code for the current language
For JavaScript, enable Drop console to remove all console.log() calls
Check the compression stats bar to see how much file size you saved
All minification runs in your browser - no code is sent to any server
Want to learn more? Read documentation →
1/8
Start typing to search...
Searching...
No results found
Try searching with different keywords