How to merge CSV files
- Choose or drop the CSV files on the box. Add as many as you need, in one go or a few at a time. They are merged in the order of the list (by file name); use the arrow to move a file up.
- Check the columns. "Columns in the result" lists every column once. A column that only some files have is
outlined; hover over it to see which files have it. If the same column shows up twice under two names, such as
EmailandE-mail, the files name it differently. - Pick the result: one CSV file, one Excel sheet, or an Excel file with one sheet per CSV file.
- Select Merge files, check the preview, and download.
What the merge does for you
- Columns matched by header name, ignoring capitals, extra spaces and hidden characters. A file without one of the columns gets empty cells there. Choose Match by position if the names differ but the order is the same.
- One header row. The header is written once. Rows inside a file that repeat a header (left over from an earlier copy and paste merge) are removed and counted.
- Source file column. Switch it on to add a first column with the name of the file each row came from.
- Files without a header row. Switch off "First row is a header row" and the columns are merged by position as Column 1, Column 2 and so on.
- Excel ready. The CSV is saved as UTF-8 with a byte order mark, which Microsoft says lets Excel open a UTF-8
CSV "normally". In the Excel result, plain numbers become number cells, while codes such as
00721and IDs longer than 15 digits stay text, so Excel keeps every digit.
How each file is read
- Encoding. A file that starts with a byte order mark is read as UTF-8 or UTF-16. Any other file is read as UTF-8, and if it contains a byte that is not valid UTF-8, it is read again as Windows-1252, the encoding of older Windows and Excel exports. The result is always UTF-8, so accents from every file come out right.
- Separator. Comma, semicolon, tab or | bar, detected per file from its first lines. The file list shows what was detected.
- Quotes. Values in double quotes may contain the separator, quotes written twice and line breaks, as RFC 4180 describes. They stay one value.
- Big files. Files are read in 4 MB pieces by a background thread of the page (a Web Worker), so the page does not freeze. In our test (Chrome 152 on a Mac with an Apple M5 chip, 17 Oct 2026), three CSV files of 104 MB each, 312 MB and 5.1 million rows in all, merged into one CSV file in about 4.5 seconds.
We tested the usual shortcut: joining the files as they are
The most common advice for merging CSV files is to join them byte for byte: copy *.csv merged.csv on
Windows, cat *.csv > merged.csv on Mac and Linux. We built three small files of the kind people really
merge, joined them with cat on macOS 26.6, and read the result with Python 3.9.6 (the csv module and
pandas 2.3.3).
| File | Like | Encoding | Columns |
|---|---|---|---|
| a.csv | Saved from Excel as CSV UTF-8 | UTF-8 with a byte order mark, CRLF line ends | Name, Email, City |
| b.csv | An older Windows export | Windows-1252, no line break after the last row | Email, Name, City |
| c.csv | A web app export | UTF-8 without a byte order mark, LF line ends | Name, Email, Phone |
What we found in the joined file:
- It is no longer valid UTF-8. pandas stopped with a
UnicodeDecodeErroron the byte of theçfrom b.csv. Read with replacement characters, "François Côté, Québec" becameFran�ois C�t�, Qu�bec: four letters lost for good once the file is saved again. - The other headers became data.
Email,Name,Cityfrom b.csv sits in the middle as a normal row. - Columns slid. b.csv has Email first, so
francois@example.comlanded in the Name column. - Two rows fused. b.csv does not end with a line break, so its last value and the next file's header joined
into one row,
Dublin+Name=DublinName, with 5 fields instead of 3. pandas refused the file: "Expected 3 fields in line 6, saw 5". - A hidden character moved into the data. When we joined c.csv first and a.csv second, a.csv's byte order mark
ended up in the middle of the file, and pandas read its header as a data row starting with an invisible
U+FEFFbeforeName. A filter that removes rows equal to "Name" misses that row.
The same three files are behind the Example files button above. Merged here, they give 5 rows and 4 columns (Name, Email, City, Phone), each value in its own column, b.csv read as Windows-1252, every accent intact and no header row repeated.
How to merge CSV files in Excel
Excel's own way is Power Query, which combines every file in a folder:
- Put the CSV files in one folder, with nothing else in it.
- Go to Data, Get Data, From File, From Folder, and choose the folder.
- Check the file list, then choose Combine, Combine & Load.
- In the Combine Files dialog, check the sample file and the file settings, and select OK.
Microsoft notes that "each file should have the same schema with consistent column headers, data types, and number of columns", and that the columns "do not have to be in the same order as the matching is done by column names". All the files in the folder are included, so remove the ones you do not want first. We did not test Power Query with mixed encodings; if accents look wrong in the result, merge the files here, where each file's encoding is detected on its own.
Related tools
Guides
Questions
How do I merge multiple CSV files into one?
Choose or drop all the files on this page, select Merge files and download the result. The header row is written once, and the columns are matched by name.
Can I merge CSV files that have different columns?
Yes. Every column from every file appears once in the result. Rows from a file that does not have a column get an empty cell in it.
How do I merge two CSV files?
The same way: drop both files and select Merge files. To compare two CSV files instead, paste the columns into compare two lists.
Will the header row be repeated in the merged file?
No. It is written once, and rows that repeat a header inside a file are removed. The result shows how many were removed.
My files use semicolons. Does that work?
Yes. The separator is detected for each file, so comma, semicolon, tab and bar files can be merged together. Choose the separator of the result under Separator.
Can I merge CSV files into an Excel file?
Yes. Choose Excel, one sheet for every row in one sheet, or Excel, one sheet per file for a workbook with a sheet for each CSV file. One Excel sheet holds at most 1,048,576 rows.
How do I know which file each row came from?
Switch on Add a Source file column. The first column then holds the file name.
Are my files uploaded?
No. They are read and merged by this page on your device. The only download is the Excel library, when you choose an Excel result.