Xerobit

CSV Merge: Combine Multiple CSV Files into One

Paste multiple CSV files separated by a delimiter line to merge them into a single CSV. The tool parses each input with a strict RFC 4180 parser, handles quoted fields, embedded commas and newlines, and lets you choose whether to keep all columns (union) or only common columns (intersection). This csv merge utility runs entirely in your browser and nothing is uploaded.

Each CSV must be separated by a line that exactly matches the separator string below.

If checked, the first row of each CSV is treated as a header. Only the header from the first CSV is kept in the output.

The delimiter used in the input CSVs.

The delimiter to use in the merged CSV.

If checked, the output will contain all columns from all CSVs (union). If unchecked, only columns present in all CSVs (intersection) are kept.

If checked, rows with a different number of columns than the header (or first row) will be noted in the summary.

Merged CSV

a,b
1,2
  • CSVs merged
    1
  • Total data rows
    1
  • Columns
    2
  • Ragged rows
    0

    All rows matched column count

How to use the csv merge

  1. Paste your CSV files into the large text area. Put the separator line (default ---CSV---) between each file.
  2. Choose whether the first row is a header. If yes, the header from the first CSV is used and headers from subsequent CSVs are dropped.
  3. Set the input delimiter (comma, semicolon, tab, or pipe) and the output delimiter.
  4. Decide if you want to keep all columns (union) or only columns present in every CSV (intersection).
  5. Enable report ragged rows to see a count of rows that don't match the expected column count.
  6. The merged CSV appears instantly in the output area. Copy it or download it.

How the csv merge works

The tool splits your input by the separator line, then parses each piece with a strict RFC 4180 parser. That parser handles quoted fields, doubled quotes (""), embedded commas, and embedded newlines (both \n and \r\n).

If First row is header is checked, the first CSV's header row defines the output columns. For each later CSV, its header row is matched by name to the output columns. When Keep all columns is on, new column names are appended to the right; when off, only columns that exist in every CSV are kept.

Rows are then written in order: all data rows from the first CSV, then all data rows from the second, and so on. The output uses the chosen output delimiter and quotes fields only when necessary (when they contain the delimiter, a quote, or a newline).

Reference: common delimiter choices

Pick the delimiter that matches your data.

DelimiterTypical useExample
Comma (,)Standard CSV, Excel exporta,b,c
Semicolon (;)European locales where comma is decimal separatora;b;c
TabTSV, copy-paste from spreadsheetsa\tb\tc
Pipe (|)Log files, some database exportsa|b|c

Practical use cases for csv merge

  • Combine monthly exports: You have sales_jan.csv, sales_feb.csv, … each with the same columns. Paste them all, keep headers on, union off, and get one file for the year.
  • Merge datasets with different schemas: One CSV has id,name, another has id,email. Turn on Keep all columns to get id,name,email with empty cells where a column is missing.
  • Normalize delimiters: Input CSVs use semicolons; you need commas for a downstream system. Set input delimiter to semicolon, output to comma.
  • Stack headerless logs: Turn off First row is header to merge raw rows by position.

Common mistakes and edge cases

  • Separator line appears inside a quoted field. The tool splits on exact line matches before parsing, so a separator inside quotes will incorrectly split the CSV. Choose a separator that cannot appear in your data (e.g., ===CSV_SEPARATOR===).
  • Ragged rows. If a row has more or fewer fields than the header, the parser pads with empty strings or truncates extras. Enable Report ragged rows to see a count in the summary.
  • Empty input. If the text area is empty or only contains the separator, you'll get an error.
  • Mismatched delimiters. If you set comma but the data uses semicolons, each row will parse as a single field. Check the column count in the summary.

RFC 4180 parsing details

The parser follows RFC 4180:

  • Fields containing the delimiter, double quotes, or newlines must be enclosed in double quotes.
  • A double quote inside a quoted field is represented by two double quotes ("").
  • Lines end with \r\n, \n, or \r; the parser accepts all three.
  • Spaces outside quotes are part of the field (they are not trimmed).
  • The parser does not enforce a fixed column count; ragged rows are reported but not rejected.

Worked example: the input line "A","B, C","D""E" with comma delimiter yields three fields: A, B, C, D"E.

Worked examples

ExampleInputResult
Two CSVs with same headersCSV inputs (separated by the separator line): name,age,city / Alice,30,New York / Bob,25,Los Angeles / ---CSV--- / name,age,city / Charlie,35,Chicago / Dana,28,Houston; Separator line: ---CSV---; First row is header: yes; Input delimiter: ,; Output delimiter: ,; Keep all columns (union): yes; Report ragged rows: yesCSVs merged: 2; Total data rows: 4; Columns: 3; Ragged rows: 0
CSVs with different columns (union)CSV inputs (separated by the separator line): id,name / 1,Alice / 2,Bob / ---CSV--- / id,email / 1,alice@example.com / 3,charlie@example.com; Separator line: ---CSV---; First row is header: yes; Input delimiter: ,; Output delimiter: ,; Keep all columns (union): yes; Report ragged rows: yesCSVs merged: 2; Total data rows: 4; Columns: 3; Ragged rows: 0
No headers, merge by positionCSV inputs (separated by the separator line): 1,2,3 / 4,5,6 / ---CSV--- / 7,8,9 / 10,11,12; Separator line: ---CSV---; First row is header: no; Input delimiter: ,; Output delimiter: ,; Keep all columns (union): yes; Report ragged rows: yesCSVs merged: 2; Total data rows: 4; Columns: 3; Ragged rows: 0
Semicolon delimiter, intersection of columnsCSV inputs (separated by the separator line): a;b;c / 1;2;3 / ---CSV--- / a;b / 4;5; Separator line: ---CSV---; First row is header: yes; Input delimiter: ;; Output delimiter: ;; Keep all columns (union): no; Report ragged rows: yesCSVs merged: 2; Total data rows: 2; Columns: 2; Ragged rows: 0
Quoted fields with embedded commas and newlinesCSV inputs (separated by the separator line): "name","description" / "Alice","Likes apples, oranges" / ---CSV--- / "name","description" / "Bob","Likes / bananas"; Separator line: ---CSV---; First row is header: yes; Input delimiter: ,; Output delimiter: ,; Keep all columns (union): yes; Report ragged rows: yesCSVs merged: 2; Total data rows: 2; Columns: 2; Ragged rows: 0

FAQ

Can I merge more than two CSV files at once?

Yes. Paste as many as you like, each separated by the separator line.

What happens if the CSVs have different column orders?

When headers are used, columns are matched by name, not position. The output column order is the first CSV's header order, followed by any new columns from later CSVs (if union is on).

Does the tool modify my data?

No. It only re-serializes the parsed fields with the chosen output delimiter and minimal quoting. Values are not trimmed, converted, or otherwise changed.

Why do I see extra quotes in the output?

The writer adds quotes only when a field contains the output delimiter, a double quote, or a newline. This is valid RFC 4180 and ensures the CSV can be parsed correctly.

Can I use a custom separator that isn't a single line?

The separator must be a full line that exactly matches the string you provide. Use a unique string like ===END_CSV=== to avoid collisions.

Is there a size limit?

The tool runs in your browser, so the limit is your device's memory. It handles a few megabytes comfortably; very large files may slow down the page.

Does this csv merge tool upload my data?

No. All parsing and merging happens in your browser. Nothing is sent to any server.