Embed this tool on your site
About this tool
Minified JavaScript is designed to be executed by machines, not read by humans. When you need a quick look at what a short third-party snippet does, or want to make a one-line minified function readable, a beautifier helps. This tool uses lightweight character-by-character heuristics rather than a full parser. When you click Beautify, it starts a new line after each statement-ending semicolon and after every opening and closing brace, indents block contents by 2 or 4 spaces, and adds a space after commas and colons. Strings, template literals, regular expressions and comments are copied unchanged. It does not add spaces around operators such as = or +, and it treats object literals and destructuring braces like code blocks. The Normalize semicolons option (on by default) appends a semicolon to lines that look like they end a statement; it can put semicolons inside object literals, so untick it for code that contains them. All processing runs in your browser with no server upload.
Why use it
Quick Readability for Snippets: Breaks a one-line minified function into indented blocks and statements so you can follow the control flow without installing anything.
Third-Party Script Auditing: Unminify a short script tag or analytics snippet to get a first look at what it does before trusting it.
Strings and Regexes Left Alone: Quoted strings, template literals, regular expression literals and comments are copied character for character, so their contents are never reformatted.
Choice of Indent Width: Pick 2 or 4 spaces to match the code you are pasting the result next to.
No Install or Build Step: Available instantly in the browser without npm install, Prettier config, or editor plugins — useful on any machine, including read-only or restricted environments.
How to use
- Paste your minified or concatenated JavaScript into the JavaScript input box.
- Choose an Indent of 2 spaces or 4 spaces.
- Leave Normalize semicolons ticked to append missing semicolons, or untick it if your code has object literals or destructuring.
- Click Beautify to format the snippet.
- Click Copy to copy the formatted JavaScript to your clipboard.
- Paste the result into your code editor or a code review tool for further reading.
When it helps
- When debugging a production JavaScript error and the stack trace points to a minified bundle that cannot be read without formatting.
- When auditing a third-party tag manager script, analytics snippet, or ad network JavaScript to verify it does not contain unexpected behavior.
- When reviewing code in a pull request where a minified build artifact was accidentally committed alongside source changes.
- When inspecting the output of a bundler (Webpack, Rollup, Vite) to understand how your modules were combined and tree-shaken.
- When working on a machine without your usual editor or Prettier setup and needing to quickly format a script before reading it.
- When extracting and reading inline JavaScript from an HTML page's script tags that were minified by a site generator or CMS.
Examples
Inputfunction add(a,b){return a+b;}const result=add(3,4);console.log(result);
Expected resultfunction add(a, b) {
return a+b;
}
const result=add(3, 4);
console.log(result);
02Object literal with Normalize semicolons off
Inputconst cfg={debug:true,level:2};
Expected resultconst cfg= {
debug: true, level: 2
};
03Minified async/await fetch
Inputasync function fetchUser(id){try{const res=await fetch(`/api/users/${id}`);if(!res.ok)throw new Error('Not found');return await res.json();}catch(e){console.error(e);return null;}}
Expected result · Scroll for moreasync function fetchUser(id) {
try {
const res=await fetch(`/api/users/${id}`);
if(!res.ok)throw new Error('Not found');
return await res.json();
}
catch(e) {
console.error(e);
return null;
}
}
Tips
- After beautifying, use Ctrl+F to search for specific function names or strings — formatted code makes keyword search far more useful than scanning minified output.
- Copy only the specific function or chunk you are investigating rather than the entire bundle — the heuristics work best on short snippets.
- Look for console.log statements in beautified third-party scripts — they are often left in minified code and reveal implementation details about what the script tracks.
- Use the 2-space output mode when preparing beautified code to show in documentation or a blog post — it is more compact and easier to read in narrow columns.
- Untick Normalize semicolons before beautifying code full of object literals, otherwise semicolons are appended after the last property.
Frequently Asked Questions
Does the JavaScript beautifier change the behavior of my code?⌄
With Normalize semicolons unticked, it only changes whitespace and line breaks. With it ticked (the default), it appends semicolons to lines that look like statement ends, which can land inside object literals or split method chains and make the output invalid. Untick it when you need the result to run.
Can it handle TypeScript or JSX?⌄
The tool is designed for standard JavaScript snippets. TypeScript annotations and JSX are treated as plain characters, so they may format oddly. For TypeScript and JSX formatting, use Prettier with the appropriate parser in your editor.
What is the difference between beautifying and deobfuscating JavaScript?⌄
Beautification restores readable formatting (whitespace and indentation) but cannot reverse obfuscation techniques like variable renaming (a, b, c), string encoding, or control-flow flattening. For obfuscated code, beautification is the first step — readable structure makes manual analysis easier, but fully reversing obfuscation requires dedicated deobfuscation tools.
Does it parse JavaScript like Babel or Prettier?⌄
No. It scans the code one character at a time, tracking strings, comments, regexes and brace depth. That keeps it small and fast, but it cannot tell an object literal from a code block and it does not add spaces around operators.
Is there a file size limit?⌄
There is no enforced size limit. Very large bundles may take a moment to process as all formatting runs in your browser's JavaScript engine.
How does this compare to running Prettier locally?⌄
Prettier parses the code into a syntax tree and reprints it in a strict, consistent style. This tool is a quick read-only helper for pasting a snippet you want to read. For project-wide formatting or code you will run, Prettier with a .prettierrc is the right choice.
Can I use it to recover readable code from a bundled library?⌄
Partly. Bundlers rename modules and may merge multiple files, so beautified output may have single-letter variable names and no module boundaries. The tool restores block structure and line breaks, but object-heavy bundle code will look rough because object literals are indented like blocks.
Glossary
- Minification
- The automated process of removing whitespace, comments, and shortening variable names in JavaScript to reduce file size for faster browser download. Produces code that executes identically but is unreadable.
- Beautification (Pretty-Printing)
- The reverse of minification — reformatting code with consistent indentation, line breaks, and spacing to make it human-readable. Also called code formatting or pretty-printing.
- Obfuscation
- A more aggressive transformation than minification that renames variables to meaningless names and encodes strings to make reverse-engineering difficult. Beautification cannot undo obfuscation.
- AST (Abstract Syntax Tree)
- A tree representation of the syntactic structure of source code. Full formatters such as Prettier parse code into an AST and re-serialize it; this tool uses lighter character-level heuristics instead.
- IIFE (Immediately Invoked Function Expression)
- A JavaScript pattern where a function is defined and immediately called: (function() { ... })(). Commonly used in bundler output to create isolated scopes.
- Source Map
- A file (.map) that maps minified/bundled output back to the original source files with original variable names and line numbers. Source maps make DevTools debugging of production bundles possible without a beautifier.
A LITTLE HELP. A LOT DONE.
Good tools.
Great flow.
Your shortcut to the everyday. Create, convert, calculate,
and get back to what you love.
✳
✳
✓ Free to use✓ No sign-up✓ 500+ possibilities