Code Formatter
Free online code formatter powered by Prettier for JavaScript, TypeScript, JSON, HTML and CSS. Set indent and print width, get precise syntax errors. Runs in your browser.
Runs locally · data never uploaded
Advertisement
How to use
What it does
An online code formatter built on Prettier, supporting JavaScript, TypeScript, JSON, HTML and CSS. Paste your code, pick the language and indent options, hit "Format" and get neatly laid-out code.
Options include indent width (2 / 4) and maximum print width. When the code has a syntax error, Prettier throws and the tool shows the message verbatim (with line/column hints) so you can locate the problem. All formatting happens in your browser — no code is uploaded.
Example
Paste unformatted JS:
const a={b:1,c:function(){return 2}}Pick JavaScript with 2-space indent and format:
const a = {
b: 1,
c: function () {
return 2;
},
};FAQ
Q1.Which languages are supported?
JavaScript, TypeScript, JSON, HTML and CSS today. Other languages such as Python or Go are not wired up yet; use the official tooling for those.
Q2.Why does formatting fail?
Usually a syntax error in the source — a missing bracket, an unmatched quote, or a trailing comma in JSON. The error message points to the rough location; fix it and format again.
Q3.How do I pick indent and print width?
Indent is commonly 2 (front-end projects) or 4 (back-end / legacy). Print width defaults to 80 but modern projects often use 100 or 120. Match your team conventions.
Q4.Is my code uploaded?
No. Formatting runs through Prettier inside your browser and keeps working offline; no code leaves your device.
Advertisement
Related tools
JSON Formatter & MinifierFormat, beautify and minify JSON online. Custom indent, sortText Tools BoxFree online text toolbox: remove duplicate or empty lines, tText Diff & CompareFree online text diff tool. Compare two texts in line, charaHTML Entity Encode / DecodeFree online HTML entity encoder and decoder. Supports named Regex TesterFree online regex tester. Live match highlighting, capture g