Code Formatter
Beautify or minify JavaScript, HTML, CSS, YAML, and SQL. Configurable indent. All processing is local.
Beautify or minify JavaScript, HTML, CSS, YAML, and SQL — clean up the indentation and whitespace, or strip it all out. Useful for tidying a copy-pasted snippet from a Stack Overflow answer, inspecting a minified production bundle, or normalising whitespace before diffing two versions of the same file. Formatting runs against the parser in your browser, so proprietary code being cleaned up does not get sent through a remote formatter service.
Next steps
JSON Formatter
RecommendedInstantly format, validate, or minify JSON — spot errors in seconds.
YAML Formatter
RecommendedFormat, validate, and convert YAML — with JSON ↔ YAML conversion.
Diff Checker
Spot every change between two texts with side-by-side highlighting.
Regex Tester
Write and test regex patterns with real-time match highlighting.
What Is a Code Formatter?
Common Use Cases
Cleaning up pasted snippets
Restore readable indentation to code copied from chat windows, PDFs, or Stack Overflow answers where formatting was lost.
Preparing JS for inline embedding
Minify a small helper script with Terser to drop directly into a <script> tag in HTML email or a server-rendered page.
Reformatting compressed CSS
Expand a single-line production stylesheet back to a multi-line layout for debugging the cascade in DevTools.
Tidying YAML configs
Re-emit a Kubernetes or GitHub Actions YAML file with consistent 2-space indent and stable key ordering before committing.
Frequently Asked Questions
Advertisement