JavaScript 压缩工具 — A lightweight JavaScript minifier that strips block and line comments and collapses whitespace. Useful for one-off scripts, bookmarklets, and snippets where you want a quick size reduction without setting up a build pipeline.
Your JavaScript is processed locally and never sent over the network.
Was JavaScript 压缩工具 useful?
JavaScript 压缩工具是什么?
A lightweight JavaScript minifier that strips block and line comments and collapses whitespace. Useful for one-off scripts, bookmarklets, and snippets where you want a quick size reduction without setting up a build pipeline.
CAUTION: This is a syntactic minifier, not a real parser. It does not understand strings, template literals, or regular expressions, so it can mangle code that contains // or /* * / inside those constructs. For production code, use Terser, esbuild, or SWC.
使用方法
-
Paste your JS
A snippet, a function, or a small module.
-
Read the minified output
Comments and excess whitespace are stripped.
-
Copy
Grab the result for use elsewhere.
示例
Comment stripping
Block and line comments go away.
/* greet */ const greet = (name) => {
console.log("hi", name); // say hi
}; 结果: const greet = (name) => { console.log("hi", name); };
Whitespace collapse
Multiple spaces and newlines become one.
const a = 1;
结果: const a = 1;
常见问题
相关指南
How to Minify HTML, CSS, and JavaScript Without Breaking Your Site
Minification shrinks your HTML, CSS, and JavaScript files by removing whitespace, comments, and dead code. Learn what it does, what it does not do, when to use it, and how to safely minify a file in your browser without uploading the source.
Markdown vs HTML vs Rich Text: Which Format Wins for Content Creation?
A practical guide to content formats: the three choices (Markdown, HTML, rich text), the trade-offs (readability, control, portability), the right format for each use case (blog, documentation, email, code, books), and the conversion workflow that keeps everything in sync.
相关工具
Last reviewed: 2026-11-21