JavaScript minifier
Minify JavaScript by stripping comments, collapsing whitespace and compressing code for production. Reduces bundle size instantly.
No output yetWhat is JavaScript Minifier?
A JavaScript minifier is a build optimization tool that reduces the file size of your JavaScript code by removing everything that is not needed for execution. This includes single-line comments (//), multi-line comments (/* */), excess whitespace, line breaks, and unnecessary spacing around operators and punctuation. The result is a compact, single-line script that browsers parse and execute faster. Minified JavaScript directly improves page load performance by reducing download size and parse time, which positively impacts Core Web Vitals metrics like First Contentful Paint (FCP) and Time to Interactive (TTI). Professional build tools like Webpack, Vite, and Rollup include minification as a production step, but this free online JavaScript minifier lets you quickly compress individual scripts without setting up a build pipeline. All processing happens in your browser — nothing is uploaded to a server, so your source code stays completely private.
How to Use JavaScript Minifier
- 1
Paste your JavaScript source code
Copy your JavaScript code from your editor or file and paste it into the input field. The tool accepts any JavaScript including functions, classes, modules, and ES6+ syntax.
- 2
View the minified output
The minified result appears instantly below the input. Single-line and multi-line comments are stripped, whitespace is collapsed, and operator spacing is compressed into the smallest possible output.
- 3
Check savings and copy
Review the character count comparison showing original size, minified size, and percentage saved. Click Copy to grab the minified code for use in your production build or CDN deployment.
Features
- Strips both single-line (//) and multi-line (/* */) comments
- Collapses all whitespace including tabs and newlines into minimal spacing
- Compresses operator spacing around braces, parentheses, and semicolons
- Shows exact character count savings with percentage reduction
- Processes code instantly as you type with zero latency
- Runs entirely client-side — source code never touches a server
Related Tools
JSON Formatter & Validator
Pretty-print and validate JSON with 2 / 4 space indentation.
JSON to CSV Converter
Convert JSON arrays to CSV format. Auto-detects columns, proper escaping, download as .csv.
CSV to JSON Converter
Convert CSV data to a JSON array of objects. Handles quoted fields and commas.
HTML Formatter & Minifier
Beautify messy HTML with proper indentation or minify it for production.
HTML Minifier
Minify HTML by stripping comments, collapsing whitespace. Shows size savings.
CSS Formatter & Minifier
Beautify CSS with proper indentation or minify it for production. Strips comments.