CraftTools

JavaScript Minifier

Guide: HTML Entities, Formatting and Minifying Explained

132 → 81 characters · 39% smaller

This removes comments and extra spaces. It does not rename variables, so it is safe for any script, but the result is not as small as a full build tool would make it.

Nothing you enter or choose here leaves your device. This tool runs in your browser.

How to use

  1. 1Paste your JavaScript on the left.
  2. 2The minified code appears on the right.
  3. 3Copy the result.

Frequently asked questions

Is my code uploaded?

No. Everything runs in your browser, so what you paste never leaves your device.

Does it rename variables?

No. It only removes comments and extra whitespace, so your code behaves exactly the same.

Why is it not as small as other minifiers?

Build tools shorten variable names too. This tool trades some size for safety.

Will it break code without semicolons?

No. It keeps the line breaks that automatic semicolon insertion depends on.

Does it handle template strings and regular expressions?

Yes. Text inside strings, templates and regexes is left untouched.

Read the guide

Learn how this works and how to get the most from it.

Web & SEO

HTML Entities, Formatting and Minifying Explained

When to escape characters in HTML, how formatting and minifying differ, and how much minifying HTML, CSS and JavaScript really saves.

1 min read

CSS Minifier & Beautifier

Compress CSS to save bytes, or format it so it is easy to read.

JSON Formatter & Validator

Prettify, minify and validate JSON, with error line numbers.

HTML / XML Formatter & Minifier

Beautify or minify HTML and XML.

String Escape / Unescape

Escape and unescape strings for JSON, JavaScript, Java, Python, HTML, SQL, regex and CSV.