Deep-merge YAML documents with Helm-style overrides
Paste two or more YAML documents separated by --- and merge them left-to-right. Mappings merge recursively, later values win by default, and null can delete keys like Helm values files.
About this tool
This tool deep-merges multiple YAML documents into one YAML result. Paste a
----separated stream the same way you would layer several Helm values files:
the first document is the base, each later document overrides it, and the merged
YAML is produced locally in your browser.
The default mode matches the common Helm mental model:
- mappings merge recursively;
- when two scalar values conflict, the later document wins;
- arrays are replaced by the later document;
- a key set to
nullin a later document deletes that key.
Those defaults are useful for Kubernetes and application config, but the controls
let you choose stricter or more expansive behavior. Use Conflict precedence
to keep the first value or reject conflicts, Array merge to append or merge
lists, Array item key to line up object-list entries such as containers or
environment variables by name, and Sort keys A-Z when you want a stable
alphabetized output for diffs.
Worked example
Input:
image:
repository: app
tag: "1.0"
replicas: 1
service:
ports:
- 80
---
image:
tag: "2.0"
service:
ports:
- 443
Merged result with defaults:
image:
repository: app
tag: "2.0"
replicas: 1
service:
ports:
- 443
image.repository stays from the base document, image.tag is overridden by the
second document, and service.ports is replaced because Helm-style array merging
uses replacement by default.
Array merge modes
- Replace arrays keeps the winning document's list. This is the default and matches Helm values layering.
- Append arrays concatenates the base list and override list.
- Append unique items concatenates, then removes duplicate YAML values while preserving first-seen order.
- Merge object lists by key lines up mapping items whose
array_keyfield matches, then deep-merges those pairs. The default key isname, which fits Kubernetes-styleenv,containers, and similar lists.
Limits and edge cases
- Input is capped at 1 MiB and 20 YAML documents per merge.
- The output is canonical YAML, not a byte-for-byte patch. Comments, blank-line layout, tags, and anchors are not preserved by the YAML value model.
- Empty documents are ignored, just like empty values files.
nulldeletes keys only when Null deletes keys is enabled. Turn it off when you needkey: nullto remain in the final YAML.- Error on conflict reports the key path that disagreed. Identical values and newly added keys are still allowed.
- Shallow top-level merge replaces entire nested subtrees below a top-level key instead of recursively merging them.
FAQ
Does this match Helm values file merging?
The defaults are intentionally Helm-like for day-to-day values files: later
layers win, mappings merge recursively, lists are replaced, and null removes a
key. Helm has additional chart-specific behavior outside raw YAML values, but for
plain layered values documents this tool mirrors the rules most people need to
preview.
How do I merge Kubernetes lists such as containers or env vars?
Choose Merge object lists by key and leave Array item key as name for
common Kubernetes lists. Items with the same name are deep-merged, unmatched
items are kept in order, and items without that key are appended because there is
nothing safe to line up.
Why did my comments or anchors disappear?
The merge operates on parsed YAML values, not source spans. Comments, blank-line layout, custom tags, and anchor names are not part of that value tree, so the result is re-emitted as canonical YAML. This makes the merge deterministic but not comment-preserving.
What happens if two documents disagree on the same value?
By default the later document wins. Set Conflict precedence to First document wins to keep the base value, or Error on conflict to reject any non-identical scalar/list disagreement and report the YAML path that conflicted.
Can I merge more than two YAML files?
Yes. Paste them into one stream separated by lines containing ---. The tool
merges left-to-right, so each later document is applied on top of the accumulated
result. The current limit is 20 documents and 1 MiB total input.
Developer & Automation Access
Run it from the terminal
Same engine as this page, headless — via the gizza CLI:
gizza tool yaml-deep-merge 'image:
repository: app
tag: "1.0"
replicas: 1
service:
ports:
- 80
---
image:
tag: "2.0"
service:
ports:
- 443'New to the CLI? Get gizza →
Open it by URL
Pre-fill and auto-run this tool with query parameters — the names match the API/CLI:
https://gizza.ai/tools/yaml-deep-merge/?documents=image%3A%0A%20%20repository%3A%20app%0A%20%20tag%3A%20%221.0%22%0Areplicas%3A%201%0Aservice%3A%0A%20%20ports%3A%0A%20%20%20%20-%2080%0A---%0Aimage%3A%0A%20%20tag%3A%20%222.0%22%0Aservice%3A%0A%20%20ports%3A%0A%20%20%20%20-%20443&precedence=last&object_merge=deep&array_merge=replace&array_key=name&null_deletes=true&sort_keys=true&indent=2Machine-readable descriptor: tool.json — title + parameters JSON Schema for agents.
