All Over Tools logo
Tool Combiner
Analyze Tools Clean Tools Compare Tools Convert Tools Data Validation Extract Tools Format Tools Generate Tools Organize Tools Transform Tools
Audio Tools Font Tools Image Tools Subtitle Tools Video Tools
Archive Tools Document Tools Ebook Tools File Management Tools PDF Tools Presentation Tools
Config Tools Database Tools Dataset Tools JSON Tools Parser Tools Spreadsheet Tools XML Tools
Business Calculators Construction Calculators Date And Time Calculators Education Calculators Financial Calculators Food Calculators Health Calculators Math Calculators Science Calculators Sports Calculators Statistics Calculators
Blog About Us Contact Us

YAML Merge Tool

Merge two or more local YAML documents or multi-document streams for layered configuration (e.g. base.yaml + override.yaml) - choose document pairing, precedence, a null policy, sequence handling, and an explicit anchor/alias/merge-key/comment policy. Every conflict and unsupported construct is shown, and the merged YAML is re-serialized for preview, before export.

1. Load YAML sources

Drop YAML files here

or (two or more required)

.yaml / .yml - each file may be a single document or a --- separated multi-document stream

2. Document pairing

Controls how documents are matched across sources when one or more sources is a multi-document (--- separated) stream.

3. Merge rules

Per-path sequence overrides (optional)

Path uses dot notation from the document root, e.g. items or a.b.list (applies to the whole sequence at that path).

PathHandlingKey field (for "merge by key")

4. Anchor, alias, merge-key, comment & document-boundary policy

Plain YAML anchors/aliases can't meaningfully "merge" across separate files, so they are always resolved to their value before merging - the policy below only decides whether that's logged and allowed, or blocks the merge outright. Every option here changes engine behavior; none are decorative.

How to merge YAML files in layers

Load at least two YAML sources with Drop YAML files here and browse files, or paste text into Paste a YAML source and click Add source. The page parses, merges, and prepares downloads in the browser.

  1. Use browse files, or fill Paste a YAML source, optionally add Source name, and click Add source.
  2. Check the source order. It affects First source wins, Last source wins, and Concatenate (append in source order).
  3. Choose a Pairing mode for single documents or matching multi-document streams.
  4. Set Merge mode, Precedence for scalar & type conflicts, Null policy, and Global sequence handling.
  5. Set the policies for Anchors (&) & aliases (*), Merge keys (<<), Comments, and Document boundaries (multi-document sources).
  6. Review the preview and logs, then click Export merged YAML or Export merge report (JSON).

Merge YAML documents with the right pairing mode

Pair by document position across streams (source counts must match) combines document 1 from every source, then document 2. Counts must match, with one output document for each position.

Treat each source as exactly one document requires one document per source. A multi-document source blocks this mode.

Choose YAML merge rules for nested keys and sequences

Deep (recursive merge at every level) combines child keys inside nested mappings. Shallow (top-level keys only) replaces a nested mapping as one value. Last source wins and First source wins choose conflicting scalars, types, and replacement sequences.

Sequence choices are Replace (precedence picks one sequence), Concatenate (append in source order), Union (dedupe by full value, order preserved), and Merge by key (sequences of mappings). Add a dot-notated path such as items with Add path override for a local rule. An empty key field falls back to replacement; items without it remain raw.

Two sources with separate fields produce this output:

base.yaml:
port: 80

override.yaml:
host: app

merged:
port: 80
host: app

What YAML Merge Tool does with nulls, comments, and aliases

Null is a value (can win/lose conflicts normally) includes explicit null values in conflict resolution. Null means absent (ignored unless every source is null) ignores null when another value exists.

Expand to value before merge, log every occurrence resolves anchors and aliases before merging. The blocking choice stops the merge when one appears. The merge-key policy treats << as pre-resolved and logs it, or blocks that source. With Proceed, log that comments are discarded (never preserved on output), comments are dropped during parsing and serialization.

Review conflicts and blocked YAML merges

The result workspace shows Merged YAML preview, Every conflict & resolution, and Unsupported / logged constructs. Conflict entries show paths, candidate values, rules, sources, and output values. Logged constructs include source and line when available.

Malformed YAML, unequal document counts in position mode, a multi-document source in single mode, or a blocking policy prevents the merge. The parser can reject YAML syntax it does not handle. The tool does not check an external schema.

Layered YAML examples

Load base.yaml first and override.yaml second when the second source should take precedence. Set Last source wins, then inspect conflicts before exporting.

For lists of mapping objects, choose Merge by key (sequences of mappings) and enter a field in Global sequence merge key field. Entries with the same field value are merged; entries without it remain raw.

Merge output versus a YAML diff

This page produces merged YAML, a conflict log, and a construct log. It does not compare versions or validate an external schema. The Config File Merge Tools category lists other merge pages.

Frequently asked questions

How do I merge YAML files with an override file?

Load the base file first and the override second. Choose Last source wins, then review Every conflict & resolution before exporting.

Can I merge multi-document YAML streams?

Matching streams can use Pair by document position across streams (source counts must match). Use Treat each source as exactly one document only when each source has one document.

Are comments preserved when YAML files are merged?

Comments are discarded when Proceed, log that comments are discarded (never preserved on output) is selected. Choose Block the merge if any source contains comments to stop on comments.

How do I merge YAML lists by an id field?

Choose Merge by key (sequences of mappings) and enter the field in Global sequence merge key field. Items without that field remain raw.

Does the YAML Merge Tool upload my files?

The page makes no upload request. It reads, parses, and merges selected files in the browser, then creates exports locally. The source files are not changed.

Related Tools

59 views