Skip to content
FileConvertify
Tools

JavaScript Minifier

Create compact JavaScript from a script or ES module without uploading or executing your code.

  • Free, no sign-up
  • Text stays in your browser
  • Paste code / no upload

Up to 500,000 character units. Input is not saved. Processing stays in this browser; pasted code is not executed.

Step by step

How to minify JavaScript

  1. Step 1: Paste plain JavaScript or load the example. Remove surrounding HTML script tags. TypeScript and JSX must be compiled into JavaScript before you use this tool.

  2. Step 2: Enable ES module for source using import or export, then select Minify JavaScript. Leave it off for a classic browser script. Syntax errors appear below the controls.

  3. Step 3: Review the output, compare byte counts and copy or download the result. Module output downloads as an MJS file; classic script output uses JS. Keep your readable original for maintenance.

Conservative minification for existing scripts

The tool uses Terser to parse and print compact JavaScript. Compression transformations and identifier mangling are disabled, so this tool focuses on whitespace, comments and compact code printing. Function, class and variable names are retained rather than renamed to shorter identifiers.

This setting is useful when public names are referenced from other scripts or markup, and when you want a smaller source file without aggressive optimization. It does not promise the smallest possible build. For a production application with many modules, keep using your bundler and its project-specific optimization settings.

Choose the correct JavaScript mode

A classic script and an ES module have different parsing rules. Select ES module when the source uses import or export; module syntax implies strict mode. This tool does not resolve imports, bundle dependencies, transpile newer language features for older browsers or generate source maps.

The loaded example defines a greeting function with a local message variable. Its compact output retains the function's name and behavior while removing the ordinary explanatory comment. Regular expressions, template literals and strings are handled by the JavaScript parser instead of whitespace replacement. Test the result in your own application before replacing a deployed asset.

Comments, sizes and local processing

Comments marked with an exclamation mark, @license, @preserve or @cc_on are retained. Other comments, including source-map reference comments, may be removed. If you distribute third-party code, check that the output contains its required notices and that your deployment does not reference an outdated map.

Input is processed in a browser worker and is never evaluated by this tool. The editor accepts up to 500,000 UTF-16 units and processing has a timeout. Oversized pastes can be truncated, so inspect them first. Size totals measure UTF-8 source bytes before gzip or Brotli, not network transfer time. Download or copy the output before closing the page; drafts are not saved.

Frequently asked questions

Does the tool run my JavaScript?
No. It parses the source and generates compact output in a browser worker. The pasted code is not evaluated or added as a script to this page.
Will public function names change?
Identifier mangling and compression are disabled. The minifier retains names, but compact printing can still change formatting, quote style and comments.
Can I minify TypeScript or React JSX?
Compile TypeScript and JSX with your project's compiler first. Paste the resulting plain JavaScript into this tool.
Why did import or export cause an error?
Enable ES module for module source. This changes parsing mode; it does not fetch imported files or combine modules into a bundle.