Open Tools Tools Features Blog About Contact Proof of Privacy

Convert a Text File to CSV

Load a .txt file, tell it what separates the values and whether the first line is a header, and download a clean CSV with correct quoting. The file is read and written in your browser and never uploaded.

How do I convert a text file to CSV format?

Drag a .txt file here

or click to browse — or paste the contents into the box below

Turning a text file into a CSV that other software will actually accept

A text file that already has values separated by something is most of the way to being a CSV. What stops it being one is usually a handful of small things: the separator is a tab rather than a comma, the first few lines are a report header rather than data, and the values are unquoted, so anything containing a comma will break the moment something reads it back.

This page fixes those. Load the file, say what separates the fields, say how many lines to skip and whether the first remaining line names the columns, and the output is written with proper quoting throughout.

Quoting is the part that matters

The CSV format has one rule that everything downstream depends on: a value containing a comma, a double quote or a line break must be wrapped in double quotes, and any quote inside it must be doubled. A converter that ignores this produces a file that looks correct in a text editor and reimports with every column after the offending value shifted by one. Every field here goes through that rule, so the output reimports cleanly into Excel, Numbers, Google Sheets, a database loader or anything else that reads the standard.

Header rows, and lines that are not data

Exported reports frequently begin with a title, a run date and a blank line before the actual table starts. Those lines are not records, and leaving them in gives you a CSV whose first row is a report title and whose column count is wrong. Set the number of leading lines to skip and they are dropped before anything else happens. If the file has no header at all, untick the header option and columns are named column_1 onwards, so the output is still valid rather than losing its first record.

Which separator to choose

Tab is the default here because a text file exported from almost anything — a database client, a report writer, a spreadsheet's "save as text" — is tab-separated far more often than comma-separated. Comma, semicolon and pipe are the other common ones, semicolon being standard in regions where the comma is a decimal separator. Any whitespace handles a report whose columns are aligned with padding rather than separated by a character.

Where this differs from splitting text

This page is file-in, file-out: a .txt on disk becomes a .csv on disk, with a filename derived from the original. Split text into columns is the paste-and-transform version — text in your clipboard, a grid on screen, CSV or XLSX out. If you want a formatted spreadsheet rather than a plain CSV, text to Excel produces a real workbook, and CSV to PDF goes the other way when the result needs to be read rather than processed.

Next steps

Related tools

What to do with the result

Browse all text and data tools, or see every QuickMerge tool.

Frequently asked questions

How do I convert a text file to CSV?

Drop the .txt in, choose what separates the fields, say whether the first line is a header, and download. The output is written with proper quoting so it reimports cleanly everywhere.

My text file is tab-separated. Will that work?

Yes, and it is the default here — a text file exported from a database client, a report writer or a spreadsheet is tab-separated far more often than comma-separated. The output is converted to a proper comma-separated CSV.

How do I skip the report header at the top of my file?

Set the number of leading lines to skip. Exported reports often start with a title, a run date and a blank line, none of which are records, and leaving them in gives you a CSV whose first row is a report title.

What if my file has no header row?

Untick the header option and the columns are named column_1 onwards. That keeps the first line as data rather than silently consuming a record as column names.

Why does my converted CSV break when I open it in Excel?

Usually quoting. A value containing a comma must be wrapped in double quotes or every column after it shifts by one. Every field here goes through that rule, so if a file produced elsewhere is breaking, that is the first thing to check.

What is the difference between this and splitting text into columns?

This one is file-in, file-out — a .txt on disk becomes a .csv on disk. Split text into columns is paste-and-transform, with a live grid and both CSV and XLSX export.

Is my file uploaded to convert it?

No. It is read with the browser's own file reader and the CSV is written in this tab. Nothing is transmitted, which matters given that text exports are usually extracts from a real system.