JavaScript Minifier and Beautifier

Smaller scripts or readable code, without sending it anywhere.

Your files stay with you. Your files never leave your browser. This tool runs on your device: nothing is uploaded to our servers, so there is nothing for us to store or see.

How to use it

  1. Paste your JavaScript or open a .js file.
  2. Choose Minify or Beautify.
  3. Copy or download the result.

Where it helps

Small scripts

Shrink a tracking snippet or widget before pasting it into a page.

Reading code

Re-indent a minified script to see what it does.

Quick checks

Strip comments from code you're about to share.

Good to know

  • Stays in your browser

    Your text is processed on your device and never sent to our servers.

  • Test after minifying

    Open the page once and check it still looks and works right.

  • Not Terser

    For production bundles, a build tool saves more.

Questions people ask

How do you minify JavaScript, or beautify minified code?

Paste your JavaScript or open a .js file and choose Minify or Beautify. Minify strips comments and whitespace but keeps line breaks wherever removing them could change the meaning, and it never touches strings, template literals or regular expressions. It doesn't rename variables, so it saves less than Terser but can't break code by renaming.

  • Safe No renaming. Can't break names.
  • ASI Line breaks kept. Where they matter.
  • Strings Untouched. Templates and regex too.
  • Beautify Re-indent. Read minified code.
Is this as small as Terser or UglifyJS?
No. It only removes comments and whitespace, so it saves less than tools that also shorten variable names and rewrite code. In return it can't break your code by renaming things. For a production app, use a bundler with Terser; for a quick snippet, this is simpler and safer.
Can it break my code?
It keeps line breaks wherever removing them could change the meaning, because JavaScript sometimes relies on them instead of semicolons. It never touches strings, template literals or regular expressions. Still, always test the minified file once before you put it on a live site. Check the console for errors.
Does the beautifier restore original variable names?
No. Minifiers that rename variables lose the original names for good, so a beautified script still has names like a, b and t. Beautifying restores only spacing and indentation. Source maps, if the site publishes them, are the only way to see the original names.
Is my code uploaded?
No. Your code is processed in your browser and never sent to our servers, and nothing is stored after you close the page. That makes it safe for private source code, client projects and unreleased features you wouldn't want copied by an unknown website. Close the tab when you're done and nothing remains.
Why keep some line breaks?
JavaScript inserts semicolons automatically at some line breaks. Removing a line break after return, for example, or between two statements without semicolons, can change what the code does. The minifier keeps those breaks, which costs a few bytes but avoids hard-to-find bugs. Correct code matters more than size.
How much smaller will my script get?
For well-commented, indented code, often 20 to 40 percent. Code that's already compact shrinks less, and the tool says when it's already compact. Gzip or Brotli on your server reduces the download further, and works on top of minification. Renaming tools such as Terser save more on large bundles.
Can I read a minified script from a website?
Yes. Paste it and choose Beautify to get indented, readable code. You'll see the structure, functions and logic, even if variable names are short. It's useful for checking what a third-party widget or tracking snippet is doing on your page. Look for the network calls and the data the widget collects.
Does it support modern JavaScript?
Yes. It handles modern syntax such as arrow functions, classes, template literals, async and await and optional chaining, because it only removes whitespace and comments around tokens. It doesn't transpile code for old browsers; that's a job for a build tool such as Babel. Syntax stays exactly as written.
Does it work with TypeScript or JSX?
It's built for plain JavaScript. TypeScript and JSX often minify fine because the tool doesn't rewrite code, but type annotations and JSX tags aren't guaranteed to come out unchanged. Compile them to JavaScript first, then minify the output. Your TypeScript compiler or bundler will already do this for you.
Should I minify a tracking or chat widget snippet?
Usually the vendor already supplies a minified snippet, so there's little to gain. If you've written your own small script, such as a form helper, minifying it before pasting into a site builder keeps the page tidy. Test the page afterwards. Check the console for errors once it's live.
Are licence comments kept?
Comments are removed when minifying. If a script carries a licence notice that must stay with the code, copy that comment back to the top of the minified file. Open-source licences such as MIT usually require the notice to be kept with copies. It takes a few seconds.
Which indentation does Beautify use?
Choose the indentation in the tool's options. Each statement goes on its own line, and blocks are indented by nesting level. Use the same indentation as the rest of your project so that the beautified code is easy to compare and edit. Two spaces, four spaces or tabs.
Can I open a .js file?
Yes. Use the file button to load a script from your computer; it's read in your browser and not uploaded. Download the result as script.js or copy it to the clipboard, ready to paste into your editor, a site builder or a code snippet field.
Does it work on a phone?
Yes. Paste code or open a file on your phone and copy the result. Reading long scripts is easier on a computer, but the tool runs fully in your mobile browser, with no app and nothing uploaded, so it's fine for a quick look at a snippet.
Is the JavaScript minifier free?
Yes. It's free with no sign-up and no limit on use. It's one of the free developer tools from Marketiism, along with the HTML and CSS minifiers and the JSON formatter. Marketiism builds software for small businesses in India. Use it as often as you need, for any project.

Want this inside your own account?

Marketiism keeps your invoice numbers, GST reports, UPI payment links and WhatsApp reminders in one place. Leave your details and we'll call to set it up for your business, or start the trial yourself.

Start free trial

We use this only to contact you about Marketiism. No spam.

More Developer tools

JSON Formatter

Format, validate and minify JSON, and see exactly which line has a mistake.

JSON to CSV

Turn a JSON list of records into CSV for Excel or Google Sheets.

CSV to JSON

Convert CSV rows into a JSON list, with numbers and true/false detected.

YAML to JSON

Convert YAML config files into JSON and catch indentation mistakes.

Try it on your own business for two weeks.

14 days free, no card. If you get stuck setting up WhatsApp, we'll get on a call and do it with you.