TXT to CSV Converter – Convert Text File to CSV Online (Delimiter & Fixed-Width)

Drag file here, or click to select file

Preview
0 Rows / 0 Cols
🔍
No data
Rows per page:
  1. Paste text or upload a TXT/text/TSV/CSV file.
  2. Choose Auto detect or set a delimiter manually (comma, tab, pipe, semicolon, space).
  3. If the text looks garbled, pick the right encoding (UTF-8, GBK, Shift-JIS…) from the Encoding dropdown.
  4. Toggle "First row is header" and "Excel-compatible (BOM)" as needed.
  5. Preview instantly, then click Download CSV or Copy CSV.

Help

FAQ

How to convert fixed-width text file to CSV?Show
Use Manual delimiter → Space. The tool splits on 2+ spaces/tabs to approximate fixed-width columns.
Which delimiters are supported?Show
You can auto-detect the delimiter or manually choose comma, tab, pipe, semicolon, space, or provide a custom delimiter.
Is my data uploaded?Show
No. All processing happens locally in your browser. Nothing is sent to any server.
How to export text as a CSV file?Show
After previewing the converted table, click Download CSV to save the result as a .csv file, or click Copy CSV to copy the text to your clipboard.
Is this TXT to CSV converter free to use?Show
Yes. This TXT to CSV converter runs entirely in your browser, is free to use, and does not require registration.
Can I convert large TXT or log files to CSV?Show
You can convert reasonably large TXT or log files, but extremely large files depend on your browser memory and CPU. For very big files, it is safer to split them into smaller chunks before converting.
Why does my converted CSV show garbled characters (mojibake)?Show
The file is probably not UTF-8. Many Chinese and Japanese TXT files are saved in GBK, GB2312, Big5, or Shift-JIS. Pick the matching encoding from the Encoding dropdown and the preview will re-decode the file correctly.
Why does Excel show garbled Chinese when I open the CSV?Show
Excel on Windows expects a UTF-8 BOM to recognize UTF-8 CSV files. Keep the "Excel-compatible (BOM)" checkbox on (it is on by default) so a BOM is prepended to the downloaded file.
The first row of my file is data, not column names. How do I avoid losing it?Show
Uncheck "First row is header". The tool then treats every row as data and generates generic column labels (Column 1, Column 2, …) so your first record is no longer swallowed as the header.
Can I copy the CSV result without downloading a file?Show
Yes. Click Copy CSV to write the full CSV text to your clipboard, ready to paste into a spreadsheet, editor, or email.

How to convert TXT to CSV online

  1. Paste text or upload a TXT/text/TSV/CSV file.
  2. Choose Auto detect or set a delimiter manually (comma, tab, pipe, semicolon, space).
  3. If the text looks garbled, pick the right encoding (UTF-8, GBK, Shift-JIS…) from the Encoding dropdown.
  4. Toggle "First row is header" and "Excel-compatible (BOM)" as needed.
  5. Preview instantly, then click Download CSV or Copy CSV.

Privacy

Full guide

TXT to CSV Converter

This tool converts text with various delimiters to standard CSV files, supporting both auto-detection and manual delimiter settings. It also handles non-UTF-8 encodings, Excel-compatible BOM output, and a header toggle — the three things that most often trip up a plain "save as CSV".

Tab-Delimited (TSV)

Tab-delimited

Auto-detects tab-separated data, ideal for TSV files or data copied from spreadsheet software.

Comma-Delimited (CSV)

Comma-delimited

Auto-detects comma-separated data, the most common CSV format.

Fixed-Width Text

Space-delimited

Select Manual delimiter → Space to handle fixed-width columns. The tool splits on 2+ spaces.

What Is a TXT File?

A TXT file (plain text file, usually .txt) is the simplest possible container for text: a sequence of characters with line breaks, and nothing else — no built-in notion of rows, columns, or data types. The "structure" of a TXT file is purely a convention chosen by whoever created it: it might be comma-separated, tab-separated, pipe-separated, fixed-width (columns padded with spaces), or free-form prose.

Because TXT has no self-describing format, two problems follow:

  1. The reader has to guess the delimiter. That is what the Auto-detect mode does.
  2. The encoding is ambiguous. A TXT file carries no label saying "I am GBK" or "I am Shift-JIS", so a reader that assumes UTF-8 will show mojibake for anything else. That is what the Encoding dropdown solves.

What Is a CSV File?

A CSV file (Comma-Separated Values, .csv) is a standardized text format for tabular data. Each line is a row, and within a row the columns are separated by a delimiter (by default a comma). The one rule that makes CSV more than "just text" is quoting: a field that contains the delimiter, a newline, or a quote is wrapped in double quotes, and internal quotes are doubled. That rule is what lets a cell contain "Smith, John" without breaking the row into two columns.

This tool uses PapaParse for both parsing and writing, so quoting and escaping are handled correctly — you do not have to worry about a comma inside a cell corrupting your output.

TXT vs CSV: What Is the Difference?

AspectTXTCSV
StructureNo fixed structure — delimiter is a conventionTabular: rows + delimited, quoted columns
QuotingNoneFields with delimiter/newline/quote are quoted
Data typesEverything is textEverything is text (types are inferred by the reader)
EncodingAmbiguous, often non-UTF-8Conventionally UTF-8 (with BOM for Excel)
Best forFree-form notes, logs, single-document textTabular data exchange between apps

In short: TXT is "just characters"; CSV is "characters plus a quoting rule". Converting TXT to CSV means (a) deciding the delimiter, (b) parsing the rows, and (c) re-writing every field with correct quoting so that a value containing the delimiter no longer breaks the table.

When to Convert TXT to CSV

  • You exported data from an old system as tab- or pipe-delimited text and need a .csv for a spreadsheet or BI tool.
  • You copied a table from a web page or terminal and it landed as tab-separated text in your clipboard.
  • You have a fixed-width report (bank statement, mainframe dump, log) and want real columns.
  • You received a GBK / Shift-JIS text file that opens as garbled characters and want a clean UTF-8 CSV.
  • You need to feed a machine-learning or ETL pipeline that only accepts CSV input.

Encoding, Mojibake, and the BOM

The single most common reason a TXT-to-CSV conversion "looks wrong" is an encoding mismatch. Here is the 30-second version:

  • UTF-8 is the modern default and what the web expects. Most files from Linux/macOS and the web are UTF-8.
  • GBK / GB2312 / GB18030 is the legacy Chinese encoding. Many older .txt files from Windows in mainland China are GBK, not UTF-8.
  • Shift-JIS is the legacy Japanese encoding; Big5 is the legacy Traditional-Chinese encoding.
  • Latin-1 (ISO-8859-1) covers Western-European languages and is a safe fallback that never errors (it maps every byte to some character, even if wrong).

If your preview shows ���� or é?? where Chinese or Japanese should be, the file is not UTF-8. Pick the right encoding from the Encoding dropdown and the preview re-decodes instantly.

The Excel BOM problem. Even a perfectly valid UTF-8 CSV can open as garbled text in Excel on Windows, because Excel does not reliably auto-detect UTF-8 without a hint. The hint is a BOM (Byte Order Mark, U+FEFF) as the very first character. This tool's Excel-compatible (BOM) checkbox is on by default, so the downloaded CSV opens cleanly in Excel. Turn it off only if a downstream script chokes on the BOM.

Features

  • Auto-detect delimiter - Intelligently detects comma, tab, pipe, semicolon, and other common delimiters
  • Manual delimiter setting - Supports comma, tab, pipe, semicolon, space, or a custom delimiter for special format requirements
  • Fixed-width support - Splits on 2+ spaces to approximate fixed-width columns
  • Encoding selector - Decode GBK, GB18030, Shift-JIS, Big5, Latin1, KOI8-R, or UTF-8 — fixes garbled-text (mojibake) files
  • Excel-compatible BOM - Prepends a UTF-8 BOM so Excel opens Chinese/Japanese CSV without garbling (toggleable)
  • First row as header - Decide whether the first row is column names or data; off by default for headerless files
  • Instant preview - What you see is what you get, with search, sort, and pagination
  • Download or copy - Save as a .csv file named after your source, or copy the CSV text straight to the clipboard
  • Local processing - Data never leaves your browser, protecting your privacy

Examples

Tab-delimited

Name	Age	City
Alice	30	New York
Bob	25	London

Comma-delimited

Name,Age,City
Alice,30,New York
Bob,25,London

Pipe-delimited

Name|Age|City
Alice|30|New York
Bob|25|London

Semicolon-delimited

Name;Age;City
Alice;30;New York
Bob;25;London

Space-delimited (2+ spaces)

Name  Age  City
Alice  30  New York
Bob    25  London

Related Tools