JS Minifier
Trim JavaScript safely — remove comments and whitespace, keep every line working.
Safe minification only: comments and whitespace removed, logic and strings untouched.
Minified output
Working…
Something went wrong
Your results will appear here.
Fill in the input above and run the tool to get started.
Honest limits
This is a safe formatting-level minifier (comments + whitespace only). It does not rename variables, drop dead code, or optimize logic — for production bundles, use Terser or esbuild, which typically save 40–60%.
How to use the JS Minifier
- Paste your JavaScript into the input box.
- Press Minify JS — the compact output appears with byte savings.
- Test the output in the browser console, then copy or download it.
Examples
Example
Paste // greet
function hi(n){ return 'Hi '+n; } → function hi(n){return'Hi '+n}. Same logic, smaller file.
What this tool doesn't do
- Formatting-level only — variables are not renamed and dead code is not removed (unlike Terser/esbuild).
- Strings, template literals, and regex bodies are preserved exactly.
- Always test minified output before deploying to production.
Frequently asked questions
Related tools
HTML Minifier
Strip comments and collapse whitespace — safe for pre, textarea, and script tags.
Use toolCSS Minifier
Shrink CSS files instantly — strip comments and whitespace, keep every style intact.
Use toolOpen Graph Generator
Build perfect Open Graph and Twitter Card meta tags with a live social-share preview.
Use toolSlug Generator
Turn any title into a clean, SEO-friendly URL slug — lowercase, hyphenated, accent-free.
Use toolSERP Preview Tool
See exactly how your page appears in Google results — live preview with truncation warnings.
Use toolHeading Analyzer
Paste your HTML and audit the H1–H6 hierarchy — catch skipped levels and empty headings.
Use tool