Code Formatter

Tidy up LaTeX, BibTeX, Typst and HTML. Paste your code or open a file, choose the options and click Format. Everything happens in your browser: your code is never uploaded.

Ctrl + Enter formats (⌘ + Enter on a Mac). Tab indents; press Esc, then Tab, to leave the box.

Showing the last result that worked.

What each tab does

  • LaTeX indents environments such as itemize, align and proof, and can wrap long lines and align table columns. A line ending in % tex-fmt: skip, and everything between % tex-fmt: off and % tex-fmt: on, is left as it is.
  • BibTeX aligns the fields, puts braces around values, lists duplicate entries and missing keys, and can sort or merge entries.
  • Typst formats both the code and the markup of a .typ file.
  • HTML formats the HTML and the CSS and JavaScript inside it.

Good to know

  • Your code stays on your computer. What you type is also kept in this browser, so it is still here next time; Clear removes it (and Undo brings it back).
  • The result updates as you type. For a very large file, untick Format as I type and use the Format button instead. If the formatter finds a problem, the line is marked in the margin.
  • Formatting changes only the layout: indentation, spacing and line breaks. LaTeX is very flexible, so compile the formatted file once to be safe.
  • Each formatter is downloaded the first time you use its tab (about 1.3 MB for LaTeX, less for the others).
  • Formatting by tex-fmt, bibtex-tidy 1.15.1, typstyle 0.15.1 and Prettier 3.9.10; colours by Prism 1.30.0. All are free and open source.