JS Minifier

Input
Loading...
Minified
Loading...
Basic minify (comments + whitespace)69 chars
100% Client-Side • Zero Data Sent to Servers

Online JavaScript Minifier & Code Compressor

Compress JavaScript code by stripping comments, collapsing whitespace, and shortening statements to optimize page load speeds and bandwidth.

Local Processing & Data Privacy

All formatting, parsing, decoding, and validation executes entirely within your browser using modern Web APIs and JavaScript. Your tokens, JSON payloads, regex inputs, and queries never leave your computer.

About this Tool

Reducing the file size of JavaScript assets improves Core Web Vitals, reduces First Contentful Paint (FCP) latency, and cuts bandwidth costs for mobile users. When quick inline scripts or browser snippets need fast compression without complex Webpack or Rollup pipelines, an instant in-browser minifier is essential.

DevRef's Online JavaScript Minifier safely removes single-line and multi-line comments, eliminates redundant line breaks, collapses whitespace, and preserves critical semicolon terminators. The compression runs entirely on the client side, ensuring private API client keys and internal logic remain protected.

How to Use

  1. 1Paste JavaScript Code: Insert your unminified JavaScript function or script into the left editor pane.
  2. 2Click Minify: Click the Minify button to compress the code and see the compression ratio and byte savings.
  3. 3Compare Byte Reduction: Check original vs minified file sizes to verify payload reduction percentage.
  4. 4Copy Minified Code: Copy the compacted JavaScript output directly to your clipboard or download as a .min.js file.

Key Features

  • •Safe comment and whitespace removal preserving execution semantics
  • •Detailed size comparison statistics (original bytes, minified bytes, percentage saved)
  • •Monaco editor backend with syntax check before minification
  • •Support for modern ES6+ syntax (arrow functions, async/await, optional chaining)
  • •100% private in-browser compression: your code is never uploaded to any cloud backend

Frequently Asked Questions

Will minification break my code?

No. The minifier preserves all essential syntax delimiters, variable scopes, and string literals. Only unnecessary comments and whitespace are stripped.

What is the difference between minification and obfuscation?

Minification reduces file size for network performance while keeping variable names largely intact. Obfuscation specifically scrambles identifiers and logic to make reverse engineering difficult.

Can I minify confidential code safely?

Yes. All processing is 100% local inside your browser's JavaScript runtime. Zero code bytes are transmitted over the internet.