TFT

Merge YAML Files Online

Combine multiple YAML documents into a single, unified file. This free merge tool lets you choose how to handle conflicts and deeply merge nested structures.

YAML Merge Tool

Merge two or more YAML documents into one

Merge Strategies

Deep Merge (default)
Recursively merges nested objects. Values from Document 2 override Document 1 for conflicts.
Combine
Similar to deep merge, but Document 1 values take precedence over Document 2.
Overwrite
Simple shallow merge. Top-level keys from Document 2 completely replace Document 1.

How it works

Paste two or more YAML documents into the input areas. The merge tool combines them intelligently, handling nested structures and arrays. Choose merge strategy: deep merge for nested objects, or shallow merge for flat replacement.

When keys conflict, the tool applies your chosen strategy: override (second wins), keep first, or merge arrays. Complex nested structures merge recursively, preserving hierarchy from all sources.

Merge example:

YAML 1: database: host: localhost port: 5432 YAML 2: database: host: production.db user: admin Merged (override): database: host: production.db port: 5432 user: admin

Array handling options include concatenate (combine all), unique (remove duplicates), or replace (second replaces first). Choose based on your use case and data semantics.

When You'd Actually Use This

Environment-specific configs

Base config plus environment overrides. Dev, staging, production. Merge common settings with specific. DRY configuration management.

Helm chart values

Combine default values with custom. Override chart defaults. Environment-specific deployments. Kubernetes configuration layering.

Multi-team configurations

Each team maintains their section. Merge into unified config. Avoid merge conflicts. Parallel configuration editing.

Template customization

Base template plus customizations. User overrides defaults. Preserve base while allowing changes. Flexible configuration system.

CI/CD pipeline composition

Common steps plus job-specific. Reusable workflow components. Combine shared and unique. Maintainable pipeline configs.

Feature flag configurations

Base flags plus experiment overrides. A/B test configurations. Rollout percentages. Merge feature states.

What to Know Before Using

Deep merge preserves nested structure.Nested objects combine recursively. Only leaf values override. Parent structure preserved. Best for configuration layering.

Array merge strategy matters.Concatenate combines all elements. Unique removes duplicates. Replace uses second entirely. Choose based on data semantics.

Order affects results.First YAML is base, second overrides. Reverse order gives different result. Plan your merge sequence carefully.

Null values have special handling.Null in override may delete or keep. Configurable behavior. Understand how nulls affect your merge.

Pro tip: Document your merge strategy. Team members need to understand override behavior. Add comments to config files.

Common Questions

What's deep merge vs shallow?

Deep merge combines nested objects recursively. Shallow merge replaces entire objects. Deep is usually what you want for configs.

Can I merge more than two files?

Merge two at a time, then merge result with third. Or use command-line tools for multiple files. This tool handles two-way merge.

How are conflicts resolved?

Configurable: first wins, last wins, or error. Default is last wins (override). Choose based on your needs.

Does it preserve comments?

Comments may not survive merge. YAML parsers often drop them. Add comments to final output manually if needed.

Can I unmerge or diff?

This tool merges only. Use YAML diff tools to compare. Version control shows changes. Separate tools for different tasks.

What about YAML anchors?

Anchors expand during merge. Result has no anchors. Values merge correctly. Anchors are pre-processing feature.

Is the output valid YAML?

Yes, output is always valid YAML. Passes validation. Ready for use. Can validate again if concerned.