CSV Merger

Combine several CSV files into one. Matching headers are concatenated as-is; different headers are aligned into a single column set. Quoted fields stay whole, and nothing leaves your browser.

Files are processed locally in your browser and never uploaded.

Files are processed locally in your browser and never uploaded.

How the merger works

Files with the same header are concatenated at row boundaries. Files with different headers are read row by row and written into one aligned table.

  1. 1

    Read each header

    The first row of every file is inspected for a byte-order mark, delimiter, and column names. You can override the delimiter if detection is wrong.

  2. 2

    Choose the output columns

    All columns keeps every header in the order it first appears. First file’s columns keeps the first header and drops extras from later files. A source-file column can be prepended.

  3. 3

    Write one CSV

    When headers match, later files are appended as byte ranges of the originals, so a large merge does not decode rows. When headers differ, each data row is mapped onto the output columns and re-encoded.

What is preserved and what is not supported

  • Quoted fields follow RFC 4180: commas, line breaks, and doubled quotes ("") inside quotes are data.
  • The output uses the first file’s delimiter and line endings. A UTF-8 BOM is written if any input file had one.
  • If a file does not end with a newline, one is inserted before the next file so rows are not glued together.
  • UTF-16 files are rejected with a message; save them as UTF-8 first. At most 50 files are merged in one run.
  • Duplicate header names in one file are uniqued (name, name_2). Empty header cells become column_N.

Worked examples

Both examples use the built-in samples, so you can load them and check every number.

Merge two order files with the same header

Load “Two order files (120 + 80 rows)”, keep “All columns”, and leave the header switch on.

  1. 1q1-orders.csv has the header order_id,order_date,region,amount and 120 data rows.
  2. 2q2-orders.csv has the same header and 80 data rows, with order_id starting at 2001.
  3. 3Because the headers match, the files are concatenated: the header is written once, then every data row from Q1, then every data row from Q2.
  4. 4120 + 80 = 200 data rows. The merged file starts with the same header line.

Result: q1-orders_merged.csv with 200 data rows (120 from Q1, 80 from Q2) and four columns.

Merge staff and contractors with different columns

Load “Staff + contractors (different columns)” and keep “All columns”.

  1. 1staff.csv columns: id, name, team (4 people). contractors.csv columns: id, name, email, day_rate (3 people).
  2. 2The union of headers is id, name, team, email, day_rate — five columns, in first-seen order.
  3. 3Staff rows leave email and day_rate blank. Contractor rows leave team blank. Quoted names such as Li, Wei stay one cell.
  4. 4Switching to “First file’s columns” would keep only id, name, team and drop email and day_rate.

Result: 7 data rows and 5 columns. Open the file and the three contractor emails sit in the email column, with empty team cells.

FAQ

Questions about merging CSV files, headers, and encodings.

Is my CSV uploaded to a server?

No. The files are read with the browser’s File API on your device. There is no upload, and closing the tab discards everything.

How do I merge CSV files with different columns?

Choose “All columns”. Every header is kept; cells that a file does not have are left empty. Choose “First file’s columns” if later files should be forced into the first header.

Will the header row be repeated?

No. When “First row is a header” is on, the header is written once at the top. Later files contribute only their data rows.

What happens to quoted fields with commas or line breaks?

They stay intact. A newline inside double quotes is treated as part of the field, not as the end of a row, and doubled quotes ("") are recognised as escaped quotes.

Which delimiters are supported?

Comma, semicolon, tab, and pipe. Each file’s delimiter is detected from its first row unless you override it. The merged file uses the first file’s delimiter.

Will Excel open the merged file correctly?

Yes. If any input has a UTF-8 byte-order mark, the output keeps it. Windows CRLF line endings from the first file are kept too.

Can I see which file each row came from?

Turn on “Add a source-file column”. The original file name is prepended to every data row.

How is this different from the CSV splitter?

The splitter cuts one file into many. This page does the reverse: several files into one. After splitting, you can merge the parts back here; turn the header switch on so repeated headers are not stacked.