This is by far the best I've come across: http://jsbeautifier.org/

Available as an online tool, or on the command-line using node.js or python. The source code is available.

Answer from eozzy on Stack Overflow
🌐
JSON Formatter
jsonformatter.org › jsbeautifier
Best JSBeautifier to beautify / format JavaScript
This Javascript Beautifier that supports indentation levels: 2 tab spaces, 3 tab spaces, and 4 tab spaces. Download JS, once it's formatted, created or modified and this js file can be opened in Sublime, VSCode, and Notepad++ alternative. Best and Secure Online Javascript Formatter and Javascript Beautifier works well in Windows, Mac, Linux, Chrome, Firefox, Safari, and Edge.
🌐
Beautifier
beautifier.io
Online JavaScript beautifier
Chrome, in case the built-in CSS and javascript formatting isn't enough for you: — Quick source viewer by Tomi Mickelsson (github, blog), — Javascript and CSS Code beautifier by c7sky, — jsbeautify-for-chrome by Tom Rix (github), — Pretty Beautiful JavaScript by Will McSweeney — Stackoverflow Code Beautify by Making Odd Edit Studios (github).
🌐
Code Beautify
codebeautify.org › jsviewer
Best Javascript Beautifier tool work as JavaScript Formatter, Viewer and Prettier
It helps to run your Javascript. Beautify JS Online works well on Windows, MAC, Linux, Chrome, Firefox, Edge, and Safari. ... JS data Try it. var carInsuranceCompany = { name: "Geico", market_capital: "$34.9 billion", }; var carInsuranceCompanyObj ...
🌐
Prettier
prettier.io
Prettier · Opinionated Code Formatter · Prettier
Your code is formatted on save · No need to discuss style in code review · Saves you time and energy · And more » · JavaScript · JSX · Flow · TypeScript · JSON · CSS · Less · SCSS · styled-components 💅 · styled-jsx · HTML · Vue · Angular · Ember / Handlebars ·
🌐
freeCodeCamp
freecodecamp.org › news › alternatives-to-prettier
Alternatives to Prettier – Popular Code Linting and Formatting Tools
March 15, 2023 - See the example below for a JavaScript script file: ... Create a file .jsbeautifyrc in the root directory of your project. This option will override the default option of JS beautifier. You can also use Beautifier on your web browser.
🌐
GoOnlineTools.com
goonlinetools.com › js-formatter
Javascript Formatter - Beautify Javascript Code Online
This Best free online Javascript Formatter Beautify ugly, minified Javascript code and give it proper indentation to make it more readable.
🌐
Biome
biomejs.dev
Biome, toolchain of the web
Biome is a fast formatter for JavaScript, TypeScript, JSX, TSX, JSON, HTML, CSS and GraphQL that scores 97% compatibility with Prettier, saving CI and developer time.
Find elsewhere
🌐
FreeFormatter
freeformatter.com › javascript-beautifier.html
Free Online Javascript Beautifier / Formatter - FreeFormatter.com
Formats JavaScript files with the chosen indentation level and your choice of braces. Supports 4 indentation levels: 2 spaces, 3 spaces, 4 spaces and tabs.
🌐
GitHub
github.com › beautifier › js-beautify
GitHub - beautifier/js-beautify: Beautifier for javascript · GitHub
This little beautifier will reformat and re-indent bookmarklets, ugly JavaScript, unpack scripts packed by Dean Edward’s popular packer, as well as partly deobfuscate scripts processed by the npm package javascript-obfuscator.
Author   beautifier
🌐
Formatter.org
formatter.org › javascript-formatter
JavaScript Formatter Online – Beautify and Format JavaScript Code
JavaScript Formatter is a tool used for formatting JavaScript code according to best practices and coding standards. It can help improve code readability and maintainability by automatically formatting the code with consistent indentation, spacing, and other formatting rules.
🌐
10bestdesign
10bestdesign.com › dirtymarkup › js
DirtyMarkup Beautifier - Javascript Formatter, JS Tidy Up
A free tool to clean up your dirty Javascript code. DirtyMarkup is brings you an online JS beautifier, plus an API to tidy up your code in an application.
🌐
GeeksforGeeks
geeksforgeeks.org › utilities › javascript-formatter
Online Free JavaScript Formatter and Beautifier - GeeksforGeeks
July 23, 2025 - Our Online Javascript Code Formatter and Beautifier is the best tool to format and beautify JavaScript code.
🌐
Minifier
minifier.org › javascript-beautifier
Best Online JavaScript Beautifier / Formatter
Use our online JavaScript Beautifier to clean, format, and structure your code. Improve readability, fix indentation, and beautify JS quickly.
🌐
Copahost
copahost.com › home › javascript beautifiers: the best 5 tools available
JavaScript beautifiers: The best 5 tools available - Copahost
July 16, 2023 - We can directly paste or upload the code and press the Beatify javascript button to beatify the code. It’s very simple. We also have the options for copy and selecting all. ... 2. There are a lot many options for formatting, encoding, decoding, beautifying on this website only. We don’t need to open other sites for such options. 3. We can directly upload a file instead of copy and pasting. This is a convenient way if the code contains way too many lines. ... The codebeautify is one of the best beautifier present on the internet.
🌐
Medium
thiraphat-ps-dev.medium.com › the-best-code-formatters-for-vs-code-11704e787f92
The Best Code Formatters for VS Code | by Thiraphat Phutson | Medium
June 3, 2024 - Beautify is another popular code formatter for VS Code that supports various languages such as JavaScript, HTML, CSS, and JSON.
🌐
Reintech
reintech.io › blog › best-tools-for-linting-formatting-javascript-code
What are the best tools for linting and formatting JavaScript code? | Reintech media
January 7, 2026 - This configuration runs ESLint and Prettier on staged files before each commit, preventing improperly formatted code from entering your repository. For continuous integration, add a linting step to your CI pipeline: # GitHub Actions example - name: Lint code run: | npm run lint npm run format:check · Most production JavaScript projects benefit from this proven stack:
🌐
Text Cleaner
textcleaner.net › home › javascript formatter
JavaScript Formatter Online, JS Formatter / Beautifier
January 13, 2022 - Step 3: If you’ve done it correctly, the formatted JavaScript code should now appear in the output box (bottom side). Step 4: Feel free to use the quick copy button to copy the code. It’s the best JavaScript formatter online tool to format/beautify your JavaScript.
🌐
SmallDev
smalldev.tools › javascript-formatter-online
Online Javascript formatter, javascript beautifier - SmallDev.tools
📁Format or Beautify your javascript code instantly. With Indentation, line wrap Options, and remove extra lines. Fast, simple & secure. One click to copy.