A code formatter rewrites source files using a deterministic set of style rules - indentation, line breaks, spacing around operators, brace placement - so that the same logical code always produces the same canonical text. The point isn't aesthetics; it's eliminating bikeshedding in code review and ensuring diffs only show actual logic changes.
This tool combines several mature, single-purpose libraries instead of one monolithic formatter. JavaScript, HTML, and CSS go through js-beautify, the same engine that backs the original Online JavaScript Beautifier from 2007 and the Beautify VS Code extension. JavaScript minification routes through Terser, the modern fork of UglifyJS used by Webpack 5 and Rollup. YAML round-trips through js-yaml (the YAML 1.2 reference implementation for JavaScript), which parses your input into a JS object then re-dumps it with the requested indent. SQL uses a small in-house formatter that uppercases keywords and breaks before the major clauses.
Everything runs in your browser via WebAssembly-free JavaScript bundles, so there is no server round-trip and no risk of leaking proprietary code to a third-party API. The libraries together add roughly 250 KB gzipped to the page; once loaded they work offline indefinitely.
Beautify is a pure pretty-printer: it never changes meaning, only whitespace and the canonicalization of optional syntax (semicolons, quote style, brace position). Minify, by contrast, runs a real compiler pass. Terser parses the source into an AST, applies dead-code elimination and constant folding, mangles local variable names down to one or two characters, and re-emits the smallest equivalent string. The output behaves identically but is typically 30-60% the size of the input and unreadable by design.
Two practical caveats. First, js-beautify is a syntactic formatter, not a parser - it tolerates broken JavaScript and will happily reformat it without warning, so always run your linter or TypeScript compiler afterwards. Second, the YAML round-trip is lossy for comments: js-yaml does not preserve them, so beautifying a heavily-commented config will strip your annotations. For comment-preserving YAML formatting, edit the file by hand or use a yamlfmt-class tool.
Indent-size choice (2 vs. 4 spaces) follows project convention. Airbnb, StandardJS, and most modern JavaScript codebases use 2; Python (PEP 8), older Java codebases, and legacy enterprise SQL almost always use 4. Pick whichever matches the file you're pasting into so the output drops in cleanly without a follow-up reformat in your editor.
For minified JavaScript, Terser's default options here include compress (constant folding, dead-code elimination) and mangle (variable renaming). Property mangling and aggressive options like unsafe_arrows are deliberately off because they can break code that relies on reflection or specific function names - safer defaults for a one-shot web tool.