Code formatters and testers
Format SQL, JavaScript, HTML, XML and CSS, convert cURL to code and HTML or SVG to JSX, optimise SVG, escape strings and test regular expressions.
- SQL Formatter: Format and indent SQL for any dialect.
- JavaScript Beautifier: Format minified or messy JavaScript into readable code.
- HTML Formatter: Indent and tidy HTML, or strip it down to one line.
- XML Formatter: Pretty-print or minify XML, with error positions.
- CSS Minifier / Beautifier: Minify CSS, or expand it back to readable rules.
- HTML to Markdown: Convert HTML to clean Markdown.
- Markdown Previewer: Render Markdown as you type.
- Regex Tester: Test a pattern against text with live matches.
- Regex Cheatsheet: Regular-expression syntax with examples.
- cURL to Code Converter: Turn a curl command into fetch, axios or Python requests code.
- String Escape / Unescape: Escape or unescape text for JSON, JavaScript, Python, SQL, CSV, shell and regex.
- SVG Optimizer: Shrink SVG files with SVGO and compare the result with the original.
- SVG to JSX Converter: Convert SVG markup to JSX or a typed React component.
- HTML to JSX Converter: Convert an HTML fragment to JSX that compiles in React.
Which tool to use
- A long query on one line: the SQL Formatter indents SQL for any dialect.
- Minified or messy script: the JavaScript Beautifier lays it out as readable code.
- Markup: the HTML Formatter indents HTML or strips it to one line, and the XML Formatter pretty-prints or minifies XML and reports error positions.
- Stylesheets: the CSS Minifier / Beautifier compresses CSS or expands it back into readable rules.
- Documentation: HTML to Markdown converts a page fragment to Markdown, and the Markdown Previewer renders Markdown as you type.
- Patterns: the Regex Tester shows live matches, with the Regex Cheatsheet for syntax.
- API calls: the cURL to Code Converter turns a curl command, such as one copied from the browser's dev tools, into fetch, axios or Python requests code.
- Strings in code: String Escape / Unescape escapes text for JSON, JavaScript, Python, SQL, CSV, shell or a regular expression, and back.
- React and SVG: HTML to JSX and SVG to JSX rewrite markup so it compiles in React, and the SVG Optimizer shrinks an SVG with SVGO.
Formatting, minifying and beautifying
Formatting only changes whitespace and line breaks, so the code means the same afterwards. Minifying removes that whitespace, and usually comments, to cut bytes. Beautifying puts the layout back, but it cannot recover what a minifier threw away: shortened variable names stay short and comments do not return.
Privacy
Queries name your tables and source files can hold keys. All formatting here happens in the browser, so the code is not uploaded.
Frequently asked questions
- What is the difference between minifying and beautifying code?
- Minifying strips whitespace and comments to make a file smaller for delivery. Beautifying adds indentation and line breaks to make it readable. Neither changes what the code does.
- Can a beautifier restore minified JavaScript to the original source?
- Only the layout. Names that a minifier shortened and comments it removed are gone. Recovering the original needs a source map or the source itself.
- Does formatting SQL change what the query does?
- No. A formatter changes indentation, line breaks and keyword case. The statement the database receives is equivalent.
- Which regular expression flavour does the Regex Tester use?
- JavaScript. Patterns run on the browser's own RegExp engine, so syntax from PCRE, Python or .NET that JavaScript lacks will not work the same way.