
Options
Paste a Kubernetes manifest on the left and a cleanly formatted version appears on the right as you type, with consistent indentation, lists in the same style kubectl uses, and fields in the familiar order: apiVersion, kind, metadata, then spec. Comments, anchors, multi-line strings, and multiple documents separated by --- are kept. Turn on Remove cluster fields to strip the noise from kubectl get -o yaml output so it can be saved and re-applied. The formatter also checks for the mistakes that make kubectl apply fail, like a number where Kubernetes expects a string or a selector that doesn't match its pods. It also converts between YAML and JSON. Nothing leaves your browser.
How to format Kubernetes YAML
- Paste one or more manifests,
kubectl getoutput, orhelm templateoutput into the left pane. You can also open or drop a .yaml, .yml, or .json file. - Pick the indentation and list style. kubectl style puts the
-of a list at the same indent as its key, which is how kubectl and most Kubernetes docs write YAML. - Choose a field order. Kubernetes order sorts the top level, metadata, spec, pod spec, containers, and ports into their conventional order and leaves everything else as written.
- Read the messages under the panes and click one to jump to that line.
- Copy the result, or download it as .yaml. Switch to JSON to get JSON instead.
What "Remove cluster fields" takes out
Objects read back from a cluster carry fields that Kubernetes manages itself. Applying them again causes conflicts or noisy diffs, so this option removes them:
| Field | Why it's removed |
|---|---|
status | Written by controllers, never by you |
metadata.managedFields | Server-side apply bookkeeping, often hundreds of lines |
metadata.uid, resourceVersion, generation, creationTimestamp, selfLink | Identify one specific copy in one cluster. Applying them elsewhere fails or conflicts |
kubectl.kubernetes.io/last-applied-configuration | A JSON copy of the previous apply, stored as an annotation |
deployment.kubernetes.io/revision | Rollout counter maintained by the Deployment controller |
spec.clusterIP on Services | Assigned by the cluster. Kept when set to None for headless Services |
creationTimestamp: null in pod templates | An empty placeholder kubectl adds |
Mistakes the checker catches
| Problem | Example | What happens |
|---|---|---|
| Number as an env value | value: 8080 | kubectl rejects it: env values must be strings. Write value: "8080" |
| Unquoted yes, no, on, or off | value: on | Kubernetes reads it as the boolean true and rejects it as a string. Write "on" |
| Non-string label, annotation, or ConfigMap value | version: 2 | Rejected. Quote it: "2" |
| Selector doesn't match pod labels | matchLabels: {app: web-frontend} with pods labeled app: web | The Deployment is rejected because it could never find its own pods |
| Multi-port Service without port names | Two entries under ports with no name | Rejected |
| Invalid names and labels | name: My_App | Rejected. Names use lowercase letters, digits, and dashes |
| Duplicate keys, tabs, bad indentation | Two image: lines in one container | The YAML is invalid or silently drops a value |
| Image without a tag or with :latest | image: nginx | Works, but every node can pull a different version |
| No resource requests, limits, or probes | A container with only name and image | Works, but the pod can be evicted first or receive traffic before it's ready |
Why Kubernetes YAML breaks so easily
YAML uses indentation for structure, so one extra space moves a field into the wrong object. Kubernetes reads YAML with a YAML 1.1 parser, where yes, no, on, and off are booleans, while many editors and linters follow YAML 1.2, where they're plain text. That mismatch is why a value that looks fine in your editor can be rejected by the cluster. Quoting any value that should stay text avoids the whole problem.
Frequently asked questions
Does formatting change what my manifest does?
No. Indentation, list style, field order, and quoting are cosmetic, and Kubernetes reads the same object either way. Values, comments, and multi-line strings are kept exactly. Only Remove cluster fields changes content, and only fields that Kubernetes manages itself.
How do I clean up kubectl get -o yaml output?
Paste the output and turn on Remove cluster fields. Status, managedFields, uid, resourceVersion, creationTimestamp, and the last-applied-configuration annotation are removed, leaving a manifest you can commit to Git or apply to another cluster.
Can I convert Kubernetes JSON to YAML?
Yes. Paste the JSON, for example from kubectl get -o json, and the YAML appears on the right. A kind: List is split into separate documents separated by ---. Switch the output to JSON to convert YAML to JSON instead.
Should lists be indented under their key?
Both styles are valid YAML and mean the same thing. kubectl and the official Kubernetes docs put the dash at the same level as the key, which saves indentation in deeply nested specs. Some teams and tools like Prettier indent lists. Pick whichever matches your repository.
Does it work with Helm charts?
It formats the rendered output of helm template. Chart template files with {{ }} expressions aren't valid YAML until Helm renders them, so render first and then paste the result.
Is my manifest sent anywhere?
No. Parsing and formatting happen in your browser, so secrets, internal hostnames, and image names stay on your machine.
