Convert AWS CloudFormation JSON to YAML — Free Online, No CLI
- Paste your CloudFormation JSON template, click Convert, get clean YAML — typically 25-40% shorter than the JSON equivalent.
- Works for full stacks, nested stacks, IAM policies, and any CloudFormation resource.
- No AWS CLI, no admin rights, no upload. The conversion runs in your browser.
Table of Contents
AWS CloudFormation accepts JSON or YAML, but YAML has real advantages — shorter templates, inline comments, and the !Ref / !Sub intrinsic shortcuts. If you have a JSON template generated from an SDK, exported from Former2, or hand-written years ago, a browser converter flips it to YAML in one paste. Here's the workflow with notes on intrinsic functions and post-conversion cleanup.
The 30-Second Conversion
- Open your CloudFormation JSON template.
- Copy the full content, paste into the converter.
- Click Convert.
- Copy the YAML, save as
template.yaml. - Validate with
aws cloudformation validate-template --template-body file://template.yamlor skip the AWS CLI and usecfn-lint.
That's the base flow. You get working YAML immediately. The next section covers the one follow-up step that's worth doing.
Post-Conversion — Shorten Intrinsic Functions
CloudFormation JSON uses long forms for intrinsic functions:
{"Fn::Ref": "MyBucket"}
{"Fn::Sub": "arn:aws:s3:::${BucketName}"}
{"Fn::GetAtt": ["MyRole", "Arn"]}
The converter produces equivalent YAML in the same long form — still valid, but verbose. Find-and-replace to the short form:
!Ref MyBucket
!Sub "arn:aws:s3:::${BucketName}"
!GetAtt MyRole.Arn
The short form is idiomatic YAML-CloudFormation and saves another 10-20% of lines. cfn-flip --clean does this automatically if you have the AWS SAM CLI. For a one-off, a text editor with find-and-replace is enough.
Why YAML Beats JSON for CloudFormation
- Inline comments. Explain why a specific resource property is set the way it is. JSON can't. YAML uses
#. - Shorter. Typical templates are 25-40% fewer lines in YAML.
- Intrinsic shortcuts.
!Ref,!Sub,!GetAtt,!Ifall work in YAML only. - Better diffs. YAML shows what property changed. JSON shows brace nesting changes.
- Multi-line strings. Policy documents embedded as strings read naturally in YAML block scalars.
Some teams keep JSON for programmatic generation and YAML for review — both work.
IAM Policy JSON to YAML
IAM policies are always JSON in the AWS console, but you can embed them as YAML inside a CloudFormation template using PolicyDocument. Conversion workflow:
- Copy the IAM policy JSON.
- Paste into our converter.
- Copy the YAML output.
- Embed under
PolicyDocument:in your CloudFormation resource.
Note: PolicyDocument itself must be valid IAM policy syntax — the YAML equivalent of the JSON shape. Our converter preserves the structure, so after conversion you can paste it directly.
Former2, SDK Generators, and Legacy Templates
Common sources of CloudFormation JSON:
- Former2. Generates CloudFormation from existing AWS resources. Default output is JSON. Convert to YAML for Git.
- SDK / custom scripts. Programs that emit CFN often default to JSON because it's easier to serialize from a dict/map.
- Legacy templates. CloudFormation predates widespread YAML use in AWS; early templates are JSON.
All three convert cleanly. The only manual step post-conversion is swapping long-form intrinsics to short form, which is optional but makes the template feel native.
Shorter, Cleaner CloudFormation Templates
Paste JSON, click Convert. Save 25-40% of lines and unlock inline comments.
Open Free JSON to YAML ConverterFrequently Asked Questions
Does converting change the CloudFormation behavior?
No — JSON and YAML templates are equivalent to CloudFormation. The stack deploys identically. Conversion is purely cosmetic.
Can I convert a CloudFormation template with Fn::Sub or Fn::If to YAML?
Yes — the converter preserves the long-form intrinsic functions. After conversion, optionally rewrite them as short forms (!Sub, !If) with find-and-replace. Both forms are valid.
Does AWS CloudFormation prefer JSON or YAML?
Neither — both are fully supported. Your team preference should decide. Most teams in 2026 use YAML because of comments, shorter templates, and better diffs. AWS's own documentation examples are mostly YAML now.
What about SAM templates (AWS::Serverless)?
Same conversion process. SAM is a transform layer over CloudFormation and works with either format. If you're using sam deploy, both JSON and YAML are accepted.

