Skip to content
Developer Runs offline

Code Formatter

Format or conservatively minify HTML, CSS, JavaScript, JSON, XML, SQL and PHP, one tool for all seven.

Action

Input

0 chars

Output

0 chars
Ctrl

Questions

Does JavaScript or PHP minify actually produce tiny, single-line output?

No, deliberately. Minify here is conservative: it strips comments and collapses blank lines and indentation, but never joins statements onto one line. A real single-line minifier for JavaScript has to reason about automatic-semicolon-insertion hazards to stay correct, which a hand-written tokenizer without a full parser cannot safely guarantee - so this tool trades maximum compactness for a guarantee that it never changes what your code does.

Will formatting HTML break a <script> or <style> block inside the page?

No. Content inside <script>, <style>, <pre> and <textarea> elements is treated as opaque and copied through untouched - only the surrounding tags are indented. Reformatting code or preformatted whitespace inside those elements would risk corrupting it.

Is my code ever executed to format it?

Never, for any of the seven languages. Every formatter here is a pure text transform built on a hand-written tokenizer that recognises strings, comments and language-specific quoting well enough to move whitespace around safely - nothing is parsed into a runnable form, evaluated, or sent anywhere.

Open SQL Formatter

SQL Formatter

Beautify or minify SQL for MySQL, PostgreSQL, SQLite and SQL Server, without ever executing it.

Developer
Open JSON Formatter

JSON Formatter

Format, indent and inspect JSON with clear error reporting.

JSON
Open JavaScript Obfuscator

JavaScript Obfuscator

Compact and lightly obfuscate JavaScript entirely in your browser - no code ever leaves your machine.

Security