Code Formatter
Re-indent SQL, HTML, XML and CSS so that structure is visible.
Code Formatter
Beautify SQL, HTML/XML and CSS code.
Supported languages: SQL, HTML/XML and CSS. Nothing else is formatted. Text inside strings, comments, url() values and <pre>, <textarea>, <script> and <style> blocks is left exactly as you wrote it.
What Code Formatter does
Machine-generated SQL and markup often arrive as one unbroken line. Formatting restores the indentation and line breaks that make the structure readable.
SQL is handled by a dedicated formatter that understands clause structure. HTML, XML and CSS are re-indented structurally, with the contents of strings, comments and url() values left alone.
- Format SQL with clause-aware indentation
- Indent HTML and XML by nesting level
- Format CSS rules and declarations one per line
- Copy the formatted result
How to use Code Formatter
- 1
Select the language
Choose SQL, HTML/XML or CSS. These three are supported.
- 2
Paste the code
Paste the unformatted source into the input pane.
- 3
Format
The output pane shows the indented result. If SQL cannot be parsed, the parser's error is shown.
- 4
Copy it back
Copy the formatted text into your editor or query console.
Limits and known behaviour
- Only SQL, HTML/XML and CSS are supported. JavaScript, TypeScript and JSON are not; use the JSON tool for JSON.
- SQL is formatted with generic SQL rules, so dialect-specific syntax from MySQL, PostgreSQL or T-SQL may not be laid out ideally even when it is valid.
- Indentation width is fixed and cannot be configured.
- Formatting does not validate. Malformed markup is re-indented as best it can be, not corrected.
Privacy and data handling
Runs entirely in your browser
- Your input is processed by JavaScript running in this page. The tool sends no request anywhere, so nothing you paste is transmitted or logged by this site.
- Nothing is saved between visits. Closing or reloading the tab discards whatever is in the fields.
Site-wide data handling, including analytics and advertising, is described in the privacy policy.
Frequently asked questions
Why is my JavaScript not supported?
Formatting JavaScript correctly requires a full parser for the language. Rather than ship an approximation that can corrupt code, the tool covers the three formats it can handle safely.
Does formatting change what my SQL does?
No. Only whitespace and line breaks change. If the formatter cannot parse the statement it reports an error instead of guessing.