All Tools View Categories About Contact Privacy

IAM Policy Beautifier

Pretty-print minified or messy IAM policy JSON into clean, readable, consistently indented JSON.

Runs entirely in your browser — your policy JSON never leaves this page.


  

About IAM Policy Beautifier

A minified IAM policy pulled from a CLI response, a CloudTrail event, or a squashed Terraform state file is technically readable but painful to review — one long line (or a handful of them) with no indentation to show which brace belongs to which statement. IAM Policy Beautifier takes that JSON, parses it, and re-prints it with consistent, readable indentation so nested statements, conditions, and principal blocks are visually structured the way you would hand-format them yourself.

Formatting only requires the pasted text to be valid JSON — it does not require the document to already be a well-formed IAM policy. That distinction matters because you often want to beautify a document specifically to review whether it is well-formed. So if the JSON parses but the shape looks off (no Statement array, a statement with no Effect, and similar), the tool still formats the JSON as-is and shows a separate structural warning alongside it, rather than refusing to format until the policy is perfect.

If the pasted text is not valid JSON in the first place — a trailing comma, a missing brace, an unescaped quote inside a string — beautifying stops there and you get a specific line and column pointing at the syntax problem, the same detection technique used by the IAM Policy JSON Syntax Validator in this category.

Choose 2-space or 4-space indentation; either is purely cosmetic and has no effect on how the policy evaluates once attached to a role, user, or resource.

Features

  • Pretty-prints minified or inconsistently indented policy JSON.
  • 2 or 4-space indent, selectable.
  • Formats any valid JSON, not just structurally valid IAM policies — with a separate warning when the structure looks off.
  • Line/column JSON syntax errors when the text does not parse at all.
  • One-click copy of the formatted output.
  • Sample minified policy to try instantly.
  • 100% client-side — nothing is uploaded.

How to Use

  1. Paste minified or messy policy JSON, or click the sample.
  2. Pick 2-space or 4-space indent.
  3. Click Beautify.
  4. Copy the formatted result with the copy button.

Examples

Example 1 — one-line policy. {"Version":"2012-10-17","Statement":[{"Effect":"Allow","Action":"s3:GetObject","Resource":"*"}]} becomes a fully indented, multi-line document.

Example 2 — valid JSON, incomplete policy. {"Statement":[]} formats fine but shows a structural warning: missing Version and an empty Statement array.

Example 3 — broken JSON. A copy-paste that dropped a closing brace reports a specific line/column syntax error instead of formatting.

Benefits

  • Turns unreadable minified policies into reviewable documents instantly.
  • Formats first, validates structure second — you are never blocked from seeing the JSON just because the policy shape is imperfect.
  • Pinpoints JSON syntax errors by line and column instead of a generic failure.
  • Private — formatting runs entirely in your browser.

Frequently Asked Questions

What does "beautify" actually do?
It parses your pasted text as JSON and re-serializes it with consistent indentation (your choice of 2 or 4 spaces), sorted the way <code>JSON.stringify</code> naturally orders keys (insertion order preserved). It does not rewrite, reorder, or otherwise change any values, action names, or resource ARNs — only whitespace changes.
Does it require the pasted text to be a valid IAM policy?
No. Formatting only needs valid JSON — any JSON object or array will pretty-print. If the parsed JSON does not look like a valid IAM policy document (missing <code>Version</code>, no <code>Statement</code>, a statement missing <code>Effect</code>, and so on) the tool still formats it, but shows a separate structural warning above the output so you know the shape is off even though the formatting itself succeeded.
What happens if my pasted text is not valid JSON at all?
Formatting stops and you get a clear parse error with the line and column number where the JSON parser gave up, the same way the IAM Policy JSON Syntax Validator reports it, so you can jump straight to the mistake and fix it before trying again.
Why choose 2 vs 4 spaces?
2-space indent is the AWS console and most IaC tooling default and keeps deeply nested policies narrower; 4-space indent is a common team style-guide preference for readability. Both produce byte-identical policy semantics — indentation is whitespace only and has zero effect on how IAM evaluates the policy.
Is my policy JSON uploaded anywhere?
No — parsing and formatting both happen entirely in your browser.