JSON Pretty Print With Tabs or Spaces

Pretty print JSON with 2 spaces, 4 spaces or tabs to match your style guide. Paste JSON, pick the indent and copy the result. Free and private.

Part of the free JSON Formatter & Validator. Runs in your browser — nothing is uploaded.

JSON Pretty Print With Tabs or Spaces

Teams disagree on JSON indentation: 2 spaces, 4 spaces or tabs. Pick the style your repository uses and the formatter applies it everywhere, so your editor and linter stop fighting over whitespace.

Worked example: The same object indented with a tab

Input

{"a":1,"b":{"c":[1,2,3]}}

Tab-indented output

{
	"a": 1,
	"b": {
		"c": [
			1,
			2,
			3
		]
	}
}

Practical tip

In JavaScript, JSON.stringify(obj, null, 2) pretty prints with 2 spaces and JSON.stringify(obj, null, "\t") uses tabs.

How to use this JSON Formatter

  1. 1Use the live tool above — it runs entirely in your browser and never uploads your data.
  2. 2Paste the sample from the worked example, or use your own input.
  3. 3Copy the result, then adapt the same steps in your editor, script, or pipeline.

JSON Pretty Print With Tabs or Spaces FAQs

What is the most common JSON indent size?

Two spaces is the most common in JavaScript and web tooling. Four spaces is common in Python and Java projects, and tabs are used where editors control the visual width.

Can I pretty print JSON in the browser console?

Yes. Run JSON.stringify(data, null, 2) and log the result. This page does the same thing without writing code.

More JSON Formatter pages

Open the full JSON Formatter tool →