Merge Text Files

Combine lists or .txt files into one, end to end or line by line, then download the result.

Lists to merge

Up to 10 lists. Open several .txt or .csv files at once, or drop files on a list. Files are read in your browser and never uploaded.
0 lines
0 lines

How to merge

Mode

List 1, then list 2, and so on.

Between lists
Clean up

Trim lines and Remove empty lines work on each list before merging. Duplicates and sorting work on the merged lines. Sorting is natural, so item 2 comes before item 10.

Ctrl + Enter merges

Merged text

How to merge text files or lists

Paste each list into its own box, or press Open files and pick several .txt or .csv files at once. Files fill the empty lists first, in file name order, then get new lists of their own, up to 10. Each list shows its file name and line count, and its own Open file button replaces just that list. Choose a mode, then copy the result or press Download .txt. Files are read by your browser and never uploaded.

Three ways to merge

One after another joins the lists end to end. Line by line, side by side puts line 1 of every list on one line, joined by a tab or your own separator, then line 2, and so on. Alternate lines takes line 1 of each list, then line 2 of each, one value per line. With list 1 = a, b, c and list 2 = 1, 2 (→ marks a tab):

ModeResult
One after anothera
b
c
1
2
Line by line, side by sidea→1
b→2
c→
Alternate linesa
1
b
2
c
(empty line)

When lists have different lengths, the default is Keep going, leave missing values empty, shown above. It keeps columns aligned: the last line still has its tab, so a spreadsheet puts c in the first column and leaves the second blank. Keep going, skip missing values gives c alone, and Stop at the shortest list ends after b→2 and tells you how many lines were not used.

What the options do

  • Between lists adds nothing, an empty line, or custom text such as --- on its own line. Type \n for a line break, \t for a tab and \\ for a backslash.
  • Separator between values is a tab, a comma, a space or custom text with the same escapes. Values are not quoted, so use a tab if they contain commas.
  • Trim lines and Remove empty lines clean each list before merging. In the line-by-line modes, removing empty lines moves later lines up, so check that pairs still match.
  • Remove duplicates after merging keeps the first copy of each line. Matching is exact and case-sensitive, and separator lines are never removed.
  • Sort A to Z ignores case and sorts numbers by value, so item 2 comes before item 10. It mixes lines from all lists, so no separator is added.

Why every list must end with a line break

POSIX defines a line as text followed by a newline, but many editors save the last line of a file without one. Tools that copy bytes, such as cat or copy /b on Windows, then glue the last line of one file to the first line of the next. A file ending in apple followed by one starting with banana gives applebanana: the merged list is a line short and contains an entry that exists in neither file, which is easy to miss among thousands of keywords or URLs.

This tool reads each list as whole lines, so every list starts on a new line. Windows (CRLF), Unix (LF) and old Mac (CR) line endings are all recognised, and the result uses LF. A byte order mark at the start of a list is removed, so it can't end up as an invisible character mid-file, and the downloaded file ends with a line break.

Common uses

  • Combining keyword exports. Open the export from each research tool or seed term, tick Trim lines and Remove duplicates, and you get one clean list. If the exports share a header row, leave sorting off and only the first header is kept.
  • Merging URL lists from several crawls. Stack the exports, remove duplicates and sort to get every URL any crawl found. To see which URLs only one crawl found, use Compare Two Lists.
  • Building two-column pairs. Put old URLs in list 1 and new URLs in list 2, merge side by side with a tab, and paste the result into a spreadsheet as a redirect map. The same works for keywords and landing pages, or IDs and names.

Command-line equivalents

cat a.txt b.txt > merged.txt
awk 1 a.txt b.txt > merged.txt

Both join files end to end, but only awk 1 adds a missing final line break, so lines never glue.

paste a.txt b.txt
paste -d '\n' a.txt b.txt

paste puts lines side by side with a tab and leaves missing values empty. With -d '\n' it alternates lines, printing an empty line for a file that has run out. It keeps Windows line endings, so a carriage return ends up before each tab.

Get-Content a.txt, b.txt | Set-Content merged.txt

PowerShell's Get-Content reads line by line, so lines never glue. Windows PowerShell 5.1 defaults to the system code page; add -Encoding utf8 to both commands for accented or non-Latin text.

Limits

Up to 10 lists, with files up to 25 MB each. For more files, merge in batches: download the result and open it with the next files. Above about 2 MB of text, the result stops updating as you type; press Merge lists instead. Files are read as UTF-8, so save older encodings such as Windows-1252 as UTF-8 first. To go the other way, Split List into Chunks cuts a long list into parts, and Remove Duplicate Lines can also ignore case.

Frequently asked questions

How do I merge two text files into one?

Press Open files and pick both files, or paste each list into its own box. Keep One after another selected, then copy the result or download it as a .txt file. Each file starts on a new line, even if the one before it has no final line break.

How do I combine two lists line by line?

Choose Line by line, side by side. Line 1 of every list is joined into one line with a tab, then line 2, and so on. Tab-separated lines paste into Excel or Google Sheets as columns.

Why is the last line of one file joined to the first line of the next?

The first file doesn't end with a line break, and tools such as cat or copy /b copy the bytes exactly. This tool reads every file as whole lines, so it can't happen here. On the command line, awk 1 a.txt b.txt > merged.txt gives the same safe result.

How many files can I merge at once?

Up to 10 lists, with files up to 25 MB each. For more files, merge the first 10, download the result, then open it together with the remaining files.

Can I remove duplicates while merging?

Yes. Tick Remove duplicates after merging to keep only the first copy of each line. Matching is exact and case-sensitive, so tick Trim lines too if the same value has stray spaces in different files.

Are my files uploaded anywhere?

No. Files are read by your browser and merged on your device, so nothing is sent to a server. Lists under 200 KB in total are kept in your browser's local storage so they are still there when you come back.