Format Code Now
/
Web & markupOnline Code Editor Next: BBCode Editor ›

Online Code Editor

WM-120

Pick a language, then type or paste your code. The status line tells you if it is valid, and the formatted version appears beside it as you type. One page covers JSON, XML, YAML, HTML, CSS and JavaScript.

Runs in your browser. Nothing is uploaded.

Code

Your draft is saved in this browser only. Clear removes it.

Result

How to use it

  1. Choose the language from the Language list.
  2. Type or paste your code, open a file, or press Sample to see an example.
  3. Read the status line. If it shows an error, press Go to error to select the spot.
  4. Press Format or Minify to rewrite the text, then copy it, save it or download the result.

What each language check covers

JSON is checked against the JSON standard and XML for well-formedness. YAML is read with the js-yaml library using the YAML 1.2 core schema. CSS is checked for unclosed braces and declarations without a colon, and JavaScript is parsed with the Babel parser that Prettier uses. Errors in these come with a line and column. HTML is only checked for tag balance: every element you open must close in order. It is not checked against the HTML standard, so an unknown tag or a wrong attribute passes.

What Format and Minify change

Format rewrites the text in the editor with 2 spaces, 4 spaces or a tab, and undo brings the old text back. XML formatting collapses runs of spaces inside text, so keep the original where those spaces matter. Minify removes comments and whitespace that is not needed. For JavaScript it does not rename variables or rewrite code. YAML has no Minify because its indentation carries meaning. The HTML preview runs no scripts and loads nothing from the web.

Questions people ask

Which languages does the editor support?

Six: JSON, XML, YAML, HTML, CSS and JavaScript. Pick one from the Language list and the check, the Format button and the formatted view all switch to it. Minify is offered for every language except YAML, where indentation is part of the meaning.

Does it check my HTML for errors?

Only for tag balance. It reports a closing tag with no opening tag, an element closed in the wrong order and an element that is never closed, with the line and column. Void elements such as br and img, and tags whose end tag may be left out, such as li and p, are not flagged.

Can I run my JavaScript here?

No. The JavaScript option checks syntax, formats with Prettier and minifies, but never runs the code. To run HTML, CSS and JavaScript together, use the real-time HTML editor on this site, where scripts run in a sandboxed frame only after you turn them on.

Can I undo Format or Minify?

Yes. Both rewrite the text through the browser's own editing, so Ctrl+Z, or Cmd+Z on a Mac, brings back the text you had before. If the code has an error, neither button changes anything and the status line shows the error instead.

Is my code uploaded anywhere?

Nothing is uploaded. The editor runs in your browser, and your draft is saved only in this browser's local storage so it is there when you come back. Clear removes it. Share link puts the text in the link itself, so only people you send the link to can see it.

About this tool

Pick a language and the editor checks your code as you type and shows the formatted result beside it. JSON, XML, YAML and CSS errors are reported with their line and column, JavaScript is parsed with the Babel parser used by Prettier, and HTML is only checked for tag balance (every opened element closed in order), not against the HTML standard. Format rewrites your text in place; undo brings it back. XML formatting collapses runs of spaces inside text, and YAML has no Minify. The HTML preview runs no scripts and loads nothing from the web. Your draft is kept in this browser only.

Format Code Now: free, no ads, no accounts. Your input stays in your browser.