Skip to content

YAML Merge

Merge two YAML documents with intelligent conflict resolution. Combine Kubernetes manifests, consolidate CI/CD configs, and merge configuration files from multiple sources with customizable merge strategies and detailed conflict reporting.

Category: code
Use Case: Kubernetes Configs, CI/CD Pipelines, Environment Settings
Privacy: 100% browser-based

Merge Strategy

0 characters
0 characters

Recommended Settings

Merge Strategies

  • Use 'Prefer right' when YAML 2 contains overrides (production configs over base)
  • Use 'Prefer left' when YAML 1 is authoritative (master data over updates)
  • Enable deep merge for nested Kubernetes manifests and complex configurations
  • Append arrays for container lists, replace for complete overrides, merge for unique items

Best Practices

  • Validate both YAMLs are well-formed before merging
  • Review conflict report to understand what was changed
  • Test merged output in target system before deployment
  • Use consistent merge strategy across environment configs
  • Keep base configs generic, put environment-specific values in overrides

Pro Tips

  • Conflict report shows exact paths where values differed and which was chosen
  • Deep merge recursively combines nested maps and objects at all levels
  • Sort keys for consistent output useful in version control diffs
  • Download merged result for kubectl apply, docker-compose, or CI/CD pipelines

Most Popular

Most users prefer right with deep merge enabled for production config overrides

When to Use This Tool

Kubernetes Configuration Management

Merge environment-specific Kubernetes manifests with base configurations. Perfect for combining development, staging, and production configs where you have a base deployment.yaml and environment-specific overrides. Handle ConfigMaps, Secrets, Services, Deployments, and Ingress resources. Ideal for Helm values files, Kustomize overlays, and multi-environment K8s setups with automatic conflict resolution.

Recommended: DevOps & Kubernetes

CI/CD Pipeline Configuration

Consolidate CI/CD configurations from multiple sources into unified pipeline definitions. Essential for merging GitHub Actions workflows, GitLab CI configs, CircleCI configurations, or Jenkins pipeline files. Combine shared job definitions with project-specific overrides, merge matrix build configurations, or consolidate multi-stage deployment pipelines from different teams into a single coordinated workflow.

Recommended: CI/CD & Automation

Application Configuration & Settings

Merge application config files from multiple sources during deployment or configuration management. Combine Docker Compose files for different services, consolidate Ansible playbook variables from different inventory files, or merge application settings from base configs and environment-specific overrides. Perfect for microservices configurations, feature flag management, and multi-tenant application settings.

Recommended: Config Management

Multi-Environment Settings

Manage configuration across development, staging, and production environments by merging base configs with environment-specific overrides. Start with common settings in base.yaml, then merge dev.yaml, staging.yaml, or prod.yaml on top. Automatically resolves conflicts using your chosen strategy, ensuring production values override defaults while keeping shared settings synchronized across all environments.

Recommended: Environment Management

How It Works

1

Paste or type first YAML document into 'YAML 1 (Base)' field

2

Paste or type second YAML document into 'YAML 2 (Override)' field

3

Tool validates both YAML inputs using js-yaml parser

4

Select conflict resolution strategy: prefer left, prefer right, or combine

5

Choose array handling: append (combine all), replace (use YAML 2), or merge (unique)

6

Configure options: deep merge for nested objects, sort keys for predictable output

7

Click 'Merge YAML' to perform intelligent 2-way merge

8

Recursive merge algorithm traverses both structures comparing keys and values

9

Conflicts are detected when same key has different values in both YAMLs

10

Review merge statistics and conflict report showing all resolved conflicts

11

Examine merged output with proper YAML formatting (2-space indent, block style)

12

Copy to clipboard or download as merged.yaml file

13

All processing happens in browser - your data never leaves your device

100% Private

Files never leave your device. All processing happens locally in your browser.

Lightning Fast

Powered by Client-side JavaScript with js-yaml library (v4.1.1) and intelligent merge algorithms for optimal performance on modern browsers.

Open Source

Built with verified, open-source libraries. Fully transparent.

Frequently Asked Questions

What does 'Conflict resolution' mean?

When both YAML documents have the same key with different values, a conflict occurs. 'Prefer left' keeps values from YAML 1, 'Prefer right' keeps values from YAML 2 (default - best for overrides), and 'Combine' attempts to merge both values when possible. The conflict report shows all detected conflicts and how they were resolved. This is crucial when merging Kubernetes configs where production values should override base values.

How does array handling work?

When both YAML files contain arrays with the same name, array handling determines the merge behavior. 'Append' combines all items from both arrays (good for lists, logs, events), 'Replace' uses only items from YAML 2 (good for complete overrides), and 'Merge' combines arrays while removing duplicates based on JSON equality. Choose based on your needs: append for accumulating items, replace for config overrides, merge for unique item lists.

What is deep merge vs shallow merge?

Deep merge (enabled by default) recursively merges nested objects and maps at all levels of the YAML structure. Shallow merge only combines top-level keys. Deep merge is recommended for complex configuration files like Kubernetes manifests, Docker Compose files, or nested application configs where you want granular control over nested properties. Disable it only when you want to replace entire sections rather than merge their contents.

Should I enable 'Sort Keys'?

Sort Keys alphabetically orders all keys in the merged output YAML. Enable it for predictable, consistent output that's easier to compare in diffs and version control. Disable it to preserve the original key order from your source files. Note that YAML semantics don't depend on key order for objects, but some tools or humans may expect a specific order. Most users keep it disabled to maintain original structure.

Can I merge more than two YAML documents?

Currently, the tool merges two YAML documents at a time (2-way merge). To merge three or more documents, perform sequential merges: first merge YAML 1 and YAML 2, then merge the result with YAML 3, and so on. Download or copy the merged result after each step and use it as input for the next merge operation. This approach gives you fine-grained control over merge order and conflict resolution at each step.

Will this work with Kubernetes YAML files?

Absolutely! YAML Merge is perfect for Kubernetes manifests. Merge base deployments with environment-specific configs, combine ConfigMaps from different sources, consolidate multi-resource YAML files, or merge Helm values files. The tool handles nested structures, arrays of containers/volumes, and complex K8s resource definitions. Use 'prefer right' for environment overrides and 'append' for array fields like containers, volumeMounts, or env variables.

Are YAML comments preserved during merge?

Unfortunately, no. The js-yaml library used for parsing doesn't preserve comments when loading and dumping YAML. Comments are stripped during the merge process. This is a known limitation of most YAML parsers. If you need to preserve documentation, consider maintaining comments in separate documentation files or using YAML anchors and aliases for reusable content instead of comments.

Is my YAML data safe and private?

Yes! All YAML merging happens entirely in your browser using client-side JavaScript. Your YAML documents are never sent to any server, uploaded anywhere, or stored remotely. The js-yaml library and all processing run 100% locally, ensuring complete privacy and security for your Kubernetes secrets, application configs, CI/CD definitions, or any sensitive configuration data.