Free CSS/JS Minifier Online

Minify your CSS and JavaScript files to reduce file size and improve page load speed.

Last updated

Every kilobyte of CSS and JavaScript on your page costs something — bandwidth on slow mobile networks, parse time on weaker devices, paint delay on first render, and a measurable hit to Core Web Vitals scores that directly affect your Google search ranking. Minification removes that overhead by stripping comments, collapsing whitespace, shortening variable names, and removing unnecessary syntax — typically reducing CSS by 20-50% and JavaScript by 30-70% with zero functional change. Our free online CSS and JavaScript minifier handles both languages in one tool. Paste your code, click Minify, copy the optimised output. Use it the other direction too: paste minified code (vendor libraries, output from your build pipeline you need to debug, code copied from a production page) and click Beautify to restore readable formatting with proper indentation. For CSS, the minifier handles all standard syntax: selectors, properties, media queries, keyframe animations, CSS Custom Properties (CSS variables), and nested rules from preprocessors. For JavaScript, it handles ES6+ features (arrow functions, template literals, destructuring, classes, async/await, modules) while preserving correct semantics — no broken `for-of` loops, no mangled regex patterns, no semicolon-insertion bugs that you sometimes see with naive minifiers. Common workflows people run it for: minifying a hand-written CSS file before uploading to a static site host where build tooling is overkill, optimising a small JavaScript snippet for an embedded script tag where every byte matters, beautifying minified code from a third-party CDN for debugging or learning, preparing CSS/JS for inline embedding in HTML emails (where smaller is critical), and checking the actual size impact of code changes (the size comparison shows the exact byte savings). **Important context:** for serious production builds, your project bundler (Webpack, Vite, Rollup, esbuild, Parcel, Turbopack) almost certainly already includes minification as part of the build process, with smarter optimisations (tree-shaking dead code, scope hoisting, code splitting) than a single-file minifier can do. This tool fits the gap: small one-off minifications, hand-written code where setting up a build is overkill, and the reverse case of beautifying minified code for inspection. Everything runs in your browser — your CSS, JavaScript, source maps, and any sensitive code (API keys, internal logic, business rules) never travel to any server. Pair this with our [HTML Beautifier](/tools/html-beautifier) for HTML formatting, [CSS Minifier](/tools/css-minifier) for CSS-only workflows, [Code Beautifier](/tools/code-beautifier) for general code formatting, and [JSON Formatter](/tools/json-formatter) for JSON config files.

How to Use CSS/JS Minifier

1

Paste Code

Paste your CSS or JavaScript code into the input editor. The tool detects the language automatically based on syntax — CSS rules versus JavaScript statements.

2

Minify

Click the "Minify" button to remove whitespace, comments, and unnecessary characters. The result appears with byte-count comparison so you can see the exact savings.

3

Copy Minified Code

Copy the minified output to your clipboard and use it in your website. For deployment, paste into your CSS/JS file or include directly in HTML for inline scripts.

Features

CSS & JS Support

Minify both CSS stylesheets and JavaScript files in one tool. Each language uses syntax-aware rules so minification is safe — no broken regex patterns, no mangled CSS calc() expressions.

Compression Stats

See original and minified sizes with exact compression percentage and byte savings. Useful when comparing the impact of writing styles (verbose vs compact) on final output size.

Safe Minification

Removes whitespace, comments, and unnecessary semicolons without breaking functionality. CSS calc() expressions, JavaScript regex patterns, and string literals are preserved correctly.

Beautifier Mode

Reverse direction also supported — paste minified code and click Beautify to restore readable formatting with proper indentation. Useful for debugging or learning from minified library code.

Instant Results

Minification runs in milliseconds — no waiting for server processing, no network round-trip. The tool handles files up to several megabytes without issue.

Browser-Based & Private

All minification happens in your browser. Your code is never sent to any external server, never logged, and never stored. Useful when minifying code containing API keys, internal business logic, or proprietary algorithms.

Benefits of Using CSS/JS Minifier

Completely Free

Use CSS/JS Minifier without any cost, limits, or hidden fees. No premium plans needed.

No Installation

Works directly in your browser. No software downloads or plugins required.

100% Private

Your files and data are processed locally. Nothing is uploaded to external servers.

Works Everywhere

Compatible with Chrome, Firefox, Safari, Edge on desktop, tablet, and mobile.

No Sign-Up

Start using the tool immediately. No account creation or email verification.

Always Available

Access this tool 24/7 from anywhere in the world, on any device.

Frequently Asked Questions

No, when done correctly. Minification only removes content that does not affect execution: whitespace (browsers ignore it), comments (browsers skip them), and optional syntax (trailing semicolons, redundant braces). The minifier here uses syntax-aware parsing so it preserves anything that matters: regex patterns stay intact, calc() expressions keep their spaces, string literals are not touched, and JavaScript ASI (automatic semicolon insertion) edge cases are handled correctly. The minified code runs identically to the original.
Highly dependent on your coding style. Code with lots of comments, generous whitespace, and verbose variable names compresses dramatically — 50-70% reduction for typical hand-written code. Already-compact code (one-letter variables, no comments, single-line statements) compresses 10-20%. As a rule of thumb: a 20 KB CSS file typically minifies to 8-12 KB, and a 50 KB JavaScript file minifies to 15-25 KB. Combined with gzip compression on the server, the final wire size is even smaller (60-80% reduction from original).
Yes, 100% free with no limits on file size, number of minifications per day, or any feature gating. Minify as many CSS and JavaScript files as you need without an account. The tool runs in your browser, so there is no server cost on our side that would require limits.
Yes, but for serious production builds, your project's bundler (Webpack, Vite, Rollup, esbuild, Parcel, Turbopack) almost certainly already does minification as part of the build process — and includes smarter optimisations like tree-shaking unused code, scope hoisting, and code splitting that a single-file minifier cannot do. This tool fits the gap: hand-written code where setting up a build is overkill, one-off minifications for small static sites, third-party code without source available, and inline scripts for HTML email or embedded contexts.
Yes — arrow functions, template literals, destructuring, classes, async/await, optional chaining (`?.`), nullish coalescing (`??`), spread/rest operators, modules (`import`/`export`), and other modern syntax are all preserved correctly. The minifier uses a modern JavaScript parser, so anything that runs in current browsers (Chrome 90+, Firefox 88+, Safari 14+) minifies correctly. For older targets that need transpilation (IE11), use Babel as part of your build pipeline.
Yes — switch to Beautify mode and paste the minified code. The tool restores readable formatting with proper indentation, line breaks, and spacing. Useful for: debugging a third-party library where you only have the minified version, learning from popular libraries' source code (jQuery, lodash, etc.), and inspecting the output of your own build pipeline. Note: variable names that were mangled by the minifier (single-letter variables) cannot be restored to original names — only formatting can be recovered.
Gzip works by finding repeated byte sequences. Minified code has more repetition than verbose code — short variable names appear hundreds of times, the same patterns repeat across functions, and there is no whitespace breaking up otherwise-identical sequences. So minification reduces size by ~50% before gzip, and gzip then reduces another ~70-80% on top. Total wire size is typically 80-90% smaller than the original. For best results: minify, then gzip — your web server (nginx, Apache, Cloudflare) handles the gzip step automatically if configured correctly.
No. The entire minifier runs in your browser. Your code is parsed and re-emitted locally using JavaScript, and the result is generated entirely on your device. Nothing travels over the network. This privacy posture matters when minifying code that contains API keys, internal business logic, OAuth client IDs, or any other sensitive content you would not want sitting on a third-party server.

Complete Your Developer Tools Workflow

These free tools work seamlessly with CSS/JS Minifier to handle every step of your workflow.