YAML 格式化与校验
格式化并检查 YAML
在浏览器中运行 · 无需上传
此工具及本页说明目前仍为英文。功能完全相同:一切都在你的浏览器中运行。
你的浏览器版本过旧,无法运行此工具。请更新浏览器,或使用最新版的 Chrome、Edge、Firefox 或 Safari。
- 任何内容都不会离开你的设备
- 服务器不限制文件大小
- 无需注册,无水印
- 免费
How to format YAML
- Paste your YAML, open a .yaml file, or try the example.
- Choose the indentation, and whether keys should be sorted.
- Copy or download the result. A mistake is shown with its line and column.
What is checked
- Indentation that doesn't line up, and tabs used for indentation (YAML allows only spaces).
- Unclosed brackets and quotes, and a missing space after a colon.
- The same key twice in one mapping.
- Every document of a file separated by ---.
Comments are kept
Many YAML tools drop comments when they reformat a file. This one keeps them, along with anchors (&name) and aliases (*name), so it is safe for GitHub Actions workflows, Docker Compose and Kubernetes files. Values are never changed: the reformatted file is the same data in a tidier layout.
常见问题
Why is my YAML invalid?
The most common causes are a tab used for indentation, a key indented one space too many or too few, and a colon inside an unquoted value. The message shows the line and column where the problem starts.
Can I convert YAML to JSON here?
Use the YAML to JSON Converter, which turns YAML into JSON and back.
Is my file uploaded?
No. Everything happens in your browser, and the page is blocked from uploading anything.