JavaScript壓縮工具
基礎的JavaScript壓縮:移除註解和不必要的空白。生產環境請使用真正的壓縮工具(Terser、esbuild)。
如何使用本工具
- 1
Paste or type your JavaScript into the input textarea.
- 2
The minified output appears instantly in the panel below as you type — there is no button to press.
- 3
Check the size readout (original length, an arrow, and minified length) to see how much was removed.
- 4
Select the text in the output box and copy it manually into your file.
什麼是JavaScript壓縮工具?
JavaScript壓縮可減小程式碼套件體積並縮短剖析時間。本工具執行基礎的空白和註解移除。對於生產環境的程式碼套件,請使用Terser、esbuild或SWC:它們會進行變數名稱混淆和死碼消除,從而產生體積大幅縮小的輸出(通常可減少60%到80%)。
常見使用場景
Quickly shrinking a short, comment-heavy snippet before pasting it into a tight inline <script> tag.
Stripping comments out of a code sample to share a compact version in a chat or gist.
Estimating roughly how much comment and whitespace overhead a small file carries before setting up a real build.
Cleaning up a hand-written configuration object or constant block that has no strings containing slashes.
Demonstrating to students or teammates what basic comment and whitespace removal looks like versus a real compiler.
Minifying a tiny utility function for a bookmarklet where pulling in a full toolchain is overkill.
常見問題
它和Terser相比如何?▼
這會破壞我的程式碼嗎?▼
相關工具
JWT 解碼器
即時解碼 JSON Web Token(JWT)。完全在你的瀏覽器中執行:權杖絕不會離開你的裝置,可安全用於正式環境的密鑰。
JSON格式化與驗證工具
線上格式化、驗證和壓縮JSON。完全在你的瀏覽器中執行:你的資料永遠不會離開你的裝置。
XML 格式化工具
格式化並美化 XML 文件。適用於 SOAP、網站地圖、RSS 訂閱源和設定檔。
Base64 編碼與解碼工具
將字串編碼為 Base64,或將 Base64 解碼為文字。尊重你的隱私:全部在你的瀏覽器中執行。
URL 編碼與解碼工具
將文字轉換為 URL 安全的編碼(百分號編碼),或進行反向轉換。適用於查詢字串、重新導向和 OAuth 流程。
HTML實體編碼與解碼工具
將特殊字元轉換為HTML實體(&、<等),或進行反向轉換。適用於將文字安全地嵌入HTML。