All Tools View Categories About Contact Privacy

IAM Policy Minifier

Compact an IAM policy JSON document to a single line, with a size-reduction summary.

Runs entirely in your browser — your policy JSON never leaves this page.
0
original chars
0
minified chars
0%
saved

About IAM Policy Minifier

Some workflows need an IAM policy document as a single compact line rather than a nicely indented block — pasting into an AWS CLI --policy-document flag, embedding inside a Terraform heredoc string, or setting it as a Lambda/CI environment variable where multi-line values are awkward. IAM Policy Minifier takes a pasted policy document and strips every non-significant character of whitespace, producing the exact same JSON on a single line.

Like the companion Beautifier tool, minifying only requires valid JSON — it does not require the document to already be a structurally complete IAM policy. If the JSON parses but the shape looks incomplete (missing Version, no Statement, and similar) the tool still minifies it and shows a separate structural warning alongside the result, rather than blocking you from getting the compact output.

A size-reduction panel shows the original character count, the minified character count, and the percentage saved — useful context, though worth knowing that AWS itself measures policy size against its character-count quotas with whitespace already excluded, so minifying does not change how much of your size quota a policy consumes; it only changes how compact the text is to paste around.

Features

  • Minifies any pasted policy JSON to a single line.
  • Size-reduction stats — original chars, minified chars, percent saved.
  • Works on any valid JSON, not just structurally valid IAM policies — with a warning when the shape looks incomplete.
  • Line/column JSON syntax errors when the text does not parse.
  • One-click copy of the minified output.
  • Sample policy to try instantly.
  • 100% client-side — nothing is uploaded.

How to Use

  1. Paste policy JSON, or click the sample.
  2. Click Minify.
  3. Copy the single-line result with the copy button.
  4. Check the size stats if you are curious how much whitespace was removed.

Examples

Example 1 — indented policy. A typical 12-line formatted policy becomes one line, with the character-count panel showing the whitespace removed.

Example 2 — already minified. Running an already single-line policy through the tool reports 0% saved — there is nothing left to strip.

Example 3 — broken JSON. A copy-paste missing a closing bracket reports a specific line/column syntax error instead of minifying.

Benefits

  • Produces a single-line policy ready to paste into a CLI flag, heredoc, or env var.
  • No semantic change — whitespace only, output evaluates identically to the input.
  • Shows exactly how much was saved, in characters and percent.
  • Private — minifying runs entirely in your browser.

Frequently Asked Questions

What does minifying change?
Only whitespace — every newline, indent, and space between JSON tokens is removed, producing the exact same document on a single line. No key, value, action name, or resource ARN is altered.
Does minifying change what the policy does?
No. JSON whitespace is not significant, so a minified policy evaluates identically to its indented equivalent once attached to a role, user, group, or resource.
Does minifying reduce the size that counts against AWS policy size limits?
Not in the way you might expect. AWS measures inline and managed policy size against its character-count quotas <em>excluding whitespace</em>, so a pretty-printed and a minified version of the same policy already count as the same size for quota purposes. Minifying mainly helps when you need a compact single-line string to paste into a CLI flag, a Terraform heredoc, or a Lambda environment variable — not to fit under a size limit that already ignores whitespace. Use the separate IAM Policy Size Checker tool to check quota usage.
Does it require the pasted text to already be a valid IAM policy?
No — minifying only needs valid JSON. If the parsed JSON does not look like a well-formed IAM policy document, it still minifies, but a separate structural warning is shown above the output.
What if my pasted text is not valid JSON?
Minifying stops and you get a clear parse error with the line and column where the JSON parser gave up.
Is my policy JSON uploaded anywhere?
No — parsing and minifying both run entirely in your browser.