Skip to main content

Kubernetes YAML Formatter

Clean up and beautify Kubernetes manifests: re-indent to a consistent 2- or 4-space step, optionally reorder keys into the conventional apiVersion → kind → metadata → spec order, and normalize quoting — across multi-document (---) files. Runs entirely in your browser; nothing is uploaded.

Input

Drop a file or browse
One file · text
Or

Output

Formatted YAML
 
Was this helpful?

Guides

The Kubernetes YAML Formatter cleans up and beautifies Kubernetes manifests. Paste a Deployment, Service, ConfigMap, Ingress, or any other resource — or a multi-document file that bundles several of them — and get back tidy, consistently indented YAML that is easy to read, review, and commit.

It is built for the practical subset of YAML that real Kubernetes manifests use: mappings, lists, scalars, quoted strings, | and > block scalars, flow collections like {} and [], and multi-document files separated by ---. Everything runs on your own machine, so it is safe to paste manifests that contain internal hostnames, image references, or configuration.

How to use it

  1. Paste your manifest into the input box, or upload a .yaml / .yml file.
  2. Pick an indent size — 2 spaces (the Kubernetes community default) or 4 spaces.
  3. Optionally turn on Sort keys to reorder every mapping into the conventional apiVersionkindmetadataspec order, with the remaining keys sorted alphabetically.
  4. Copy the formatted result or download it as manifest.yaml.

The output updates automatically as you type or change options.

What does "Sort keys" actually do?

When enabled, top-level resource keys are placed in the order Kubernetes documentation and most style guides use: apiVersion, kind, metadata, spec, then data-carrying keys (data, stringData, binaryData, rules, roleRef, subjects) and finally status. Any key not in that list — plus every nested mapping — is sorted alphabetically. This is what makes a hand-edited manifest look like one generated by a well-behaved tool, and it makes diffs between manifests far easier to read. Leave it off to preserve your original key order and only normalize indentation and quoting.

Does it change my values or types?

No. Numbers, booleans, and null stay unquoted so they keep their type, while strings you explicitly quoted — such as "5432" or "64Mi" — stay quoted, so a port or memory value never silently turns into a number. Flow collections such as args: ["--v=2"] and emptyDir: {} are preserved exactly.

Does it validate my manifest?

It validates that the YAML is well-formed and parseable — malformed indentation, tab characters used for indentation, and structural errors are flagged before formatting runs. It does not perform full Kubernetes schema validation (checking required fields or deprecated API versions); it is a formatter, not an admission controller.

What about comments?

Because the formatter parses the document and re-emits it — which is what allows key reordering — inline and standalone # comments are not carried into the output. If you need to keep comments in place, format with keys sorting turned off and re-add them, or use a comment-preserving editor.

Privacy

This tool runs entirely in your browser. Your manifests are never uploaded to a server, logged, or stored — the parsing and formatting happen locally in JavaScript. You can even use it offline once the page has loaded.

kubernetesk8syamlmanifestformatterbeautifierdevopsindentation

Use it from code

From 3 credits per call

REST API

curl -X POST https://api.iotools.cloud/v1/tool/kubernetes-yaml-formatter \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "inputYaml": "apiVersion: apps/v1\nkind: Deployment\nmetadata:\n …",
    "indentSize": "2",
    "sortKeys": ""
  }'

Swap in your own key from your account. The tool's fields are the body — no wrapper.

Ask an AI agent

Use the IOTools `kubernetes-yaml-formatter` tool (Kubernetes YAML Formatter) on this input:

YOUR_INPUT_HERE

Paste this at any agent connected to the IOTools MCP server, then add your input.

Love the tools? Lose the ads.

One payment clears every ad from your account, for good. No subscription, no tracking.