Minify IAM policies to save character space with size comparison.
Last verified: April 2026
Output will appear here...The minifier parses the input as JSON, then re-serializes it with zero indentation and no whitespace between tokens using a compact JSON.stringify call. It calculates the before and after byte lengths using UTF-8 encoding, which matches how AWS counts characters internally, and compares the result against known limits for managed policies (6,144), inline role/group policies (10,240), and inline user policies (2,048).
AWS enforces strict character limits on IAM policy documents — 6,144 characters for managed policies and as low as 2,048 for user inline policies. When policies grow complex with many actions, resources, and conditions, you can hit these limits quickly. The IAM Policy Minifier strips all unnecessary whitespace and provides a before/after size comparison so you can see exactly how many characters you have recovered and whether your policy fits within the applicable limit.
Your team's deployment pipeline fails at 2pm on a Friday with 'MalformedPolicyDocument: Policy document length exceeds limit.' The Terraform plan added three new S3 actions to a managed policy that was already at 6,100 characters formatted. You paste the policy into the minifier and see it's 6,201 characters without whitespace — 57 over the limit. You combine two statements and the minified size drops to 5,890. Deploy passes. Weekend saved.
AWS counts policy size after stripping whitespace, but the character limit includes Unicode escapes. A policy with non-ASCII characters (e.g., tag values in Japanese) can blow past the 6,144-character limit even if it looks short. Always check the byte count, not just the character count.
If you're within 200 characters of the limit, refactor before minifying. Combine statements that share the same Effect and Condition, use wildcard actions (s3:Get* instead of listing 12 Get actions), and replace repetitive resource ARNs with policy variables like ${aws:PrincipalTag/team}.
Inline policies on IAM users have a brutal 2,048-character limit. If you're hitting it, that's a design smell — move to managed policies (6,144-character limit, up to 10 per principal) or rethink your permission boundaries.
AWS counts the policy document after removing all whitespace — spaces, tabs, and newlines are excluded. This means a pretty-printed 8,000-character policy might actually be only 4,500 characters as far as AWS limits are concerned. The minifier shows you the exact count AWS would calculate, so you know your true margin.
If minification alone is not enough, you can use wildcard actions (s3:Get* instead of listing every Get action), combine similar statements, use policy variables like ${aws:username} to reduce duplicate statements per user, or split the policy into multiple managed policies (up to 10 can be attached to a single role). Moving from inline to managed policies also gives you a higher character limit.
Was this tool helpful?
Disclaimer: This tool runs entirely in your browser. No data is sent to our servers. Always verify outputs before using them in production. AWS, Azure, and GCP are trademarks of their respective owners.