How to Format (Pretty-Print) JSON Online
Format and beautify JSON online for free. Pretty-print minified JSON with 2-space, 4-space, or tab indentation, with clear errors when something's invalid.
By QR Ivify Team
A minified API response that's unreadable as one long line, a config file someone saved without any indentation, a JSON blob copied out of a log — pretty-printing turns it back into something you can actually read and edit. Here's how JSON formatting works, and why the error messages are as precise as they are.
Formatting Doesn't Just Add Indentation
Pretty-printing JSON does more than insert line breaks and spaces for readability — it also proves the JSON is syntactically valid, since formatting requires successfully parsing it first. If your JSON has a stray comma, a missing quote, or an unclosed bracket, formatting fails with a specific error rather than producing a half-formatted, still-broken result.
Why the Error Messages Are Precise
QR Ivify's JSON Formatter uses the browser's own native JSON.parse, the same parser every browser uses to interpret JSON internally — not a custom reimplementation that might validate slightly differently than what actually consumes your JSON later. When it fails, it reports exactly what the native parser found wrong, so "invalid JSON" becomes something specific and actionable instead of a generic failure.
Step by Step
- Open the JSON Formatter.
- Paste your JSON into the box.
- Choose an indentation style — 2 spaces, 4 spaces, or tabs.
- Click "Format." If it's invalid, a specific error message explains what's wrong.
- Copy or download the result.
Spaces or Tabs?
Both are valid JSON formatting choices — the difference is purely about what your editor or team convention prefers. Tabs let each person's editor render indentation at whatever width they've configured; spaces render identically everywhere but take a fixed amount of horizontal room regardless of viewer settings. If you're formatting something that'll go into a codebase with an existing style (an .editorconfig, a linter rule), match that; otherwise 2 spaces is the most common default for JSON specifically.
Frequently Asked Questions
What happens if my JSON is invalid? You'll see a specific error message describing what's wrong, rather than a silently broken or empty result.
Can I use tabs instead of spaces? Yes — choose 2 spaces, 4 spaces, or tabs before formatting.
Does this support JSON with comments (JSONC)?
No — only standard JSON, matching what JSON.parse accepts. Comments or trailing commas will be reported as invalid.
Does this upload my JSON anywhere? No. Parsing and formatting both happen entirely in your browser using the native JSON parser.
Is there a file size limit? Yes, 5 MB — comfortably more than typical config files or API responses.
Try It
Need to pretty-print JSON? QR Ivify's free JSON Formatter gives precise error messages when something's wrong. Just need to check whether JSON is valid, with the exact line and column of an error? See JSON Validator. Need it smaller instead of prettier? Try JSON Minifier.
Related articles
How to Decode Base64 Back to Text
Decode Base64 to text online for free, with correct Unicode handling and a clear error for invalid input instead of garbled output.
How to Base64 Encode Text (Without Breaking Unicode)
Encode text to Base64 online for free, with correct handling of Vietnamese, emoji, and other Unicode text — a common failure point in naive implementations.
How to Compare Two JSON Objects (Structurally, Not as Text)
Compare two JSON values online for free and see exactly what changed — key order and formatting differences are correctly ignored, unlike a plain text diff.