Minify JavaScript Online — Free JS Minifier
Minify JavaScript code instantly with our free online tool. Compress JS for production, reduce file size, or concatenate and minify multiple .js files in one pass. All processing happens in your browser — no code sent to any server.
Features
Reduce the size of your JavaScript code by removing spaces, comments and unnecessary characters.
Reduce the size of your JavaScript code by removing spaces, comments and unnecessary characters.
Package used
Terser is a modern JavaScript compressor that optimizes the size and performance of your code.
What JavaScript minification does
JavaScript minification rewrites source into a shorter form that still parses and runs the same way. It is not a zip archive: the output remains JavaScript — denser, not encoded. A minifier drops whitespace and comments, collapses equivalent syntax where it can prove the change is safe (true → !0, some if forms into &&), and shortens local identifiers. You still ship a .js file the browser executes as-is. On typical handwritten source, that often cuts 30–70% of the original bytes before gzip or Brotli.
Those extra bytes on the wire are a different layer. Minification shrinks what a transport compressor then sees; gzip and Brotli still matter after deploy. It also does not delete unused modules — that is tree shaking in a bundler, before Terser runs. And it is not obfuscation: names get short because they are local, not because control flow is hidden.
How FastMinify minifies JavaScript
This page runs Terser entirely in your browser. The pipeline is parse → compress → mangle → render; the toolbar maps onto those stages.
Parse builds an AST. Invalid JavaScript fails with a syntax error instead of emitting a broken file. Compress is the semantic pass: dead-branch elimination, constant folding, and optional stripping of console.* and debugger (Remove Console / Remove Debugger — both on by default). Compression Level changes how hard that pass works: Conservative keeps names and stays safer; Normal balances size; Aggressive enables stronger rewrites (including toplevel mangling) that can break code which depends on names. ECMAScript Version tells Terser which syntax it may emit — choosing ES5 does not transpile arrow functions you already wrote.
Mangle (Normal and Aggressive) renames locals to short identifiers. Preserve Function Names and Preserve Class Names keep those bindings when something reads Function.prototype.name or CSS class strings. Leave them on — or stay on Conservative — if you rely on eval or new Function. Render prints the AST with comments removed and the smallest legal separators.
The result is functionally identical unless aggressive compress plus mangling meets name-dependent code. Paste-and-minify is for a file or a few files; concatenation on this page merges files first, then runs the same pipeline — it is not a bundler. Production apps still belong in the build. For webpack, Vite, or CI, see the JavaScript minification guide — same engine, with a build step.
Minification options
Examples by ECMAScript version:
Original code (ES2022)
ES2022
ES5
Compression examples:
Original code
Conservative
Normal
Aggressive
Comparison with/without option:
Original code
With preserveClassNames: true
With preserveClassNames: false
Difference
Comparison with/without option:
Original code
With preserveFunctionNames: true
With preserveFunctionNames: false
Difference
Comparison with/without option:
Original code
With removeConsole: true
With removeConsole: false
Difference
Comparison with/without option:
Original code
With removeDebugger: true
With removeDebugger: false
Difference
Learn more about this action →
Learn more about this action →
Concatenating JavaScript Files
On Minify JS, combine multiple JavaScript files in list order and minify the complete bundle with your current toolbar options. Processing stays entirely in your browser. This is especially useful for projects that don't use a bundler like Webpack or Rollup.
Frequently Asked Questions — Minify
Everything about minification
Why minify JavaScript?
JavaScript minification reduces file sizes by removing whitespace, comments and shortening variable names. Typical savings are often 30% to 70% of the original bytes before gzip.
How does JavaScript minification work?
Our tool uses Terser, the industry-standard JavaScript compressor. It removes unnecessary characters while optionally mangling variable names. The minified code is functionally identical to the original.
Need to unminify JavaScript?
Use our dedicated JavaScript unminifier to restore readable formatting from minified code.
Need to beautify JavaScript?
Use our JavaScript beautifier to format code with consistent indentation.
Is my code processed securely?
All JavaScript processing happens entirely in your browser. No code is sent to any server.
Can I concatenate JavaScript files?
Yes — on Minify JS, click the concat icon above the input editor or drop two or more .js, .mjs, or .cjs files on the input panel. Files are merged in list order, then the complete bundle is minified with your toolbar options.
How do I merge multiple JS files?
Click the concat icon in the input toolbar or drop multiple valid JavaScript files on the left editor. Reorder files in the modal, then click Concatenate & Minify.
Do comment separators between files stay after minify?
Not reliably — file markers are inserted before the complete bundle is minified, so // filename comments and extra spacing are typically removed.
Can I concatenate files on Beautify JS?
Not in the current release — concatenation is available on Minify JS only.
Verify it yourself
FastMinify processes your input in the browser. Inspect the network panel or read our validation gate to confirm nothing leaves your device.
Minify
Shrink code and assets for production — minify JavaScript, CSS, HTML, JSON and XML before gzip or CDN deploy.
Explore other tool categories
Beautify
Make code readable with consistent indentation — beautify JavaScript, CSS, TypeScript, SCSS, LESS, Markdown, GraphQL, SQL, YAML and more in your browser.
Unminify
Expand minified or compressed code — unminify JavaScript, CSS, TypeScript, SCSS, LESS, SQL, YAML and other formats when debugging or reviewing.
Conversion
Transform data between JSON, YAML, XML and CSV locally — no server uploads.
CSS preprocessors
Compile SCSS or LESS to standard CSS in the browser — pair with beautify or minify for a full stylesheet workflow.
JSON Tools
Validate, format, diff and explore JSON payloads — complementary to minifiers and converters.
SVG Tools
Preview, optimize with SVGO, export Data URI, resize, beautify, convert to JSX and validate SVG — all in your browser.
DevOps & Infra
Terraform HCL format/validate/minify, Dockerfile format & lint, Docker Compose and .env validation.
CI/CD
GitHub Actions and GitLab CI — format YAML and check workflow/job structure in your browser.
Logs & observability
Line-oriented JSON/NDJSON and Nginx/Apache access logs — format, filter, validate, and CSV/TSV.
Kubernetes
Multi-doc manifests, structural validate, Ingress/Deployment starters, and Helm values formatting.
Networking / IP
CIDR, subnets, and IPv4/IPv6 helpers — in your browser.
Security & tokens
JWKS, X.509 certificates, and secrets scan — browser-local.
API & schemas
OpenAPI tools to format, validate, and lint your specs.
HTTP Tools
Paste-local cURL, HTTP messages, and URLs — format and inspect in your browser, never sent.
Encoding
Encode or decode Base64, URL components and HTML entities — client-side only.
Developer utilities
Timestamps, UUID, ULID, Nanoid, cron, passwords, regex, slugify, number bases, case, text diff, and chmod — all client-side.
Text & Markdown
Count words, build Markdown TOCs, and clean line lists — all in your browser.
AI & LLM
Token counting, pricing estimates, and context-window fit — 100% browser-local.
Test Data
Synthetic field values for fixtures and DB seed — reserved-range phone numbers first.
Serialization
Serialize and deserialize PHP data structures beside JSON workflows.