FormatterHQ

Merge CSV Files

Combine several CSV files into one. Columns are matched by header name, even in a different order, and columns missing from a file are left empty. Optionally tag rows with their source file and drop duplicates.

Loading tool…
Ready.

How to use the Merge CSV Files

  1. Drop two or more CSV files, or paste CSV and click Add as a source.
  2. Put the files in order with the arrow buttons; rows are combined in that order.
  3. Choose By header name or By position, and tick Add a column with the source file name or Remove duplicate rows if you need them.
  4. Pick the output delimiter, check the preview, then copy or download the merged CSV.

Merge CSV files with matching columns

Monthly exports, one file per store, a list from each colleague: sooner or later you need to merge CSV files into one table. Stacking them with copy and paste breaks as soon as the column order differs or one file has an extra column. This merger lines the columns up by their header names, keeps every column that appears in any file, and shows you a preview before you download. It runs in your browser, so the files are not uploaded.

Matching columns by header name

The merged file contains the union of all columns, in the order they first appear. A file that lacks a column gets empty cells there. For example:

january.csv              february.csv
id,name,email            name,email,id,phone
1,Ava,ava@example.com    Noah,noah@example.com,2,555-0100

becomes

id,name,email,phone
1,Ava,ava@example.com,
2,Noah,noah@example.com,555-0100

With Ignore case and spaces in header names ticked (the default), “Email ”, “email” and “EMAIL” land in the same column, labelled with the spelling that appeared first. If one file repeats a header name, say two “notes” columns, the first matches the first “notes” column of the other files and the second matches the second.

Matching columns by position

Choose By position when the files have the same layout but different or missing header names: column 1 goes with column 1, and so on. The output header takes each column's first non-empty name, or “Column 3” when no file names it. Files without any header row are always merged by position, and no header row is added to the output.

Source file column and duplicate rows

Add a column with the source file name appends a column (named source_file unless you change it) that tells you where each row came from, which helps when you need to trace a value back later. Remove duplicate rows keeps the first copy of every row whose cells are all identical after the columns are aligned. The source column is ignored in that comparison, so the same row in two files still counts as a duplicate. Values must match exactly: “Ann” and “ann ” are different.

Reading and writing

  • Each file's delimiter is detected on its own, so comma, semicolon and tab files can be merged together.
  • UTF-8 files (with or without a BOM) and UTF-16 files that start with a BOM are read correctly; files that are not valid UTF-8 are read as Windows-1252.
  • Quoted fields with commas, quotes and line breaks are kept intact.
  • Choose comma, semicolon, tab or pipe for the output, and tick Add UTF-8 BOM for Excel.

The summary above the preview shows the number of rows in and out, how many duplicates were removed and which files added new columns, so a header typo that creates an unexpected extra column is easy to spot. To go the other way, the CSV splitter breaks a large file into parts. Merged data can be checked in the CSV viewer, and data from spreadsheets or APIs can be turned into CSV first with Excel to CSV or JSON to CSV.

Frequently asked questions

Do the CSV files need the same columns?
No. With "By header name", every column from every file is kept, in the order it first appears, and rows from files that lack a column get empty cells there. The column order inside each file does not matter.
Can I merge CSV files that use different delimiters?
Yes. The delimiter of each file is detected separately, so a comma-separated file and a semicolon-separated file can be merged. You choose the delimiter of the merged file.
How are duplicate rows detected?
After the columns are aligned, two rows are duplicates when every cell is exactly the same. The first copy is kept. The optional source file column is not part of the comparison.
In what order are the rows combined?
Rows are added file by file in the order shown in the list, and keep their original order within each file. Use the arrow buttons to change the order of the files.
Are my files uploaded anywhere?
No. The files are read and merged by JavaScript in your browser, and the merged CSV is saved directly to your device.

Last updated October 17, 2026

Related tools

CSV Splitter Split a CSV file every N rows, into equal parts or by the values of a column. The header is kept in every file; download parts or one ZIP. Table to HTML Converter Convert CSV, TSV, Markdown or JSON data into a clean HTML table with optional CSS styling and a live preview. Tableizer: Excel to HTML Table Paste cells copied from Excel or Google Sheets and get a styled HTML table. Choose header colour, font and row striping. Compare CSV Files Compare two CSV files by key column or row position: see added, removed and changed rows with old and new values, then export the differences. CSV Editor Online Edit CSV files online like a spreadsheet: change cells, add, move or delete rows and columns, sort, filter, find and replace, undo, then export. CSV to PDF Converter Convert CSV to a printable PDF table: header row on every page, fitted and wrapped columns, A4, Letter or Legal, page numbers. Made in your browser. CSV Viewer View CSV files as a clean, sortable-looking table in your browser. Auto-detects commas, semicolons, pipes and tabs. LaTeX Table Generator Convert CSV, spreadsheet cells or JSON into LaTeX tabular code with captions, labels, borders or booktabs styling. Markdown Table Generator Generate GitHub-flavoured Markdown tables from CSV, TSV, Excel cells or JSON, with column alignment and neat padding. Base64 to CSV Decode a Base64 string back to CSV with syntax highlighting. Base64 to TSV Decode a Base64 string back to TSV with syntax highlighting. CSV Converter Convert CSV to JSON, XML, YAML, TSV, HTML, SQL or Markdown from a single page, with automatic delimiter detection.