loot.tools

Code Formatter

Format, validate, and minify JSON, JavaScript, TypeScript, HTML, CSS, XML, YAML, SQL, or Markdown in one place. Choose the language, set indent style (spaces or tabs) and size, then paste code for instant formatting with clean indentation and error feedback.

Format or minify JSON, JavaScript, TypeScript, HTML, CSS, XML, YAML, SQL, or Markdown. Choose a language, set indent style and size below, then paste code. Invalid input will show an error.

Input
Output
 
Indent:Size:

Why format your code?

Consistent formatting makes code easier to read, review, and maintain. You paste minified JSON from an API response, or messy SQL before sharing it with a teammate, and the formatter cleans it up. You skip the style arguments. Nine languages in one tool.

How to use this formatter

Pick the language from the dropdown, paste your code, and it formats instantly. You can switch between spaces and tabs, adjust indent size, or minify instead of prettifying. If there's a syntax error, the tool shows you where it is. Works great for JSON validation too - paste in a blob and the formatter will either clean it up or tell you exactly what's wrong.

Supported languages

JSON, JavaScript, TypeScript, HTML, CSS, XML, YAML, SQL, and Markdown. Each language uses a parser tuned for that syntax, so you get accurate formatting and useful error messages. JSON formatting also doubles as a validator. SQL formatting handles most common dialects.