JavaScript Formatter
Runs in browserBeautify and minify JavaScript instantly in the browser.
Beautify or minify JavaScript with flexible indentation (2 spaces, 4 spaces, or tabs). Compare byte size after minify and download .js.
JavaScript Formatter tool
1
Output
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
Files never leave your browser.
Drag and drop a file here, or tap to select
🔒 Runs in your browser · No uploads · Your data never leaves your device
How to use
Choose indentation
For Beautify, pick 2 spaces, 4 spaces, or tabs before formatting.
Minify
Switch to Minify to compact code; a size comparison appears when relevant.
Export
Copy or download .js; open local files with the upload zone below the panels.
Common use cases
- Beautifying minified JS from a CDN for debugging — Unminify JavaScript code from a CDN or bundle to read variable names and logic when debugging an issue.
- Formatting JS snippets for documentation — Format a JavaScript example with consistent indentation before adding it to a README, wiki, or API doc.
Examples
Arrow function
Pretty-print expands across lines.
Inputconst f=()=>1+1;Outputconst f = () => 1 + 1;
Frequently asked questions
- Will minify rename variables?
- This tool uses js-beautify for layout; it does not perform renaming like a full bundler minifier.
- Is my code sent to a server?
- No. Everything runs in your browser.
Key concepts
- Minification
- Removing whitespace, comments, and unnecessary characters from JavaScript to reduce file size for faster page loads.
- Beautification
- Reformatting code with consistent indentation and line breaks to make it human-readable — the opposite of minification.
Related tools
You might find these useful too.