gizmobench

Text to CSV

Paste your text on the left and the CSV appears on the right as you type, with no button to press, no upload and no account. Two things separate this from the pages that hold this search. The first is that the fields come from a setting rather than a guess: you choose the delimiter, tab, comma, semicolon, vertical bar, space, any run of spaces or a character of your own, or you switch to fixed width and type the column widths, and the readout prints which one is on. The second is that nothing disappears quietly. A line with too few or too many fields is written into the CSV exactly as it was read and listed underneath with its line number, so a row is never dropped to make the file look tidy, and padding short rows is a switch you turn on rather than something done behind your back. The writing side follows RFC 4180, so a field holding a comma, a double quote, a carriage return or a line feed is wrapped in double quotes with its own quotes doubled. The result copies to the clipboard or downloads as converted.csv.

The CSV appears here as soon as there is text to convert on the left.
Rows
Waiting
Columns
Waiting
Input
Tab
Header
First row

Paste your text on the left and the CSV appears on the right. It is converted in this tab and nothing is uploaded.

How the text is read

The fields come from a setting, never from a guess: a delimiter you pick, or column widths you type. Nothing is sorted, deduplicated or reordered on the way through.

How the text is read
Fields are taken by
Fixed width cuts each line at the widths instead of looking for a character.
Delimiter
Text copied out of a spreadsheet is tab separated. Any run of spaces treats several spaces or tabs together as one gap.
Quotes in the textReads the pasted text by the RFC 4180 rule as well, so a quoted field may hold the delimiter or a line break. It needs a single character delimiter.
The first rowIt sets the column count every other row is measured against, and it is written out as the first line of the CSV. With this off no names are invented.
SpacesOn to start, which is what fixed width columns need. Switch it off to keep every field exactly as it was typed.
Blank lines
How many were left out is counted in the line under the readout.

How the CSV is written

The file that comes out is comma separated and quoted by RFC 4180: a field holding a comma, a double quote, a carriage return or a line feed is wrapped in double quotes, and its own quotes are doubled.

How the CSV is written
QuotingOff, only the fields that need it are quoted. On, every field is wrapped, which some older importers prefer. Both are valid CSV.
Rows that are too shortOff to start. A padded row is still listed below the readout, and a row with too many fields is never cut to fit.
Spreadsheet formulasA field starting with =, +, - or @ is stored as text rather than run by the spreadsheet. A plain number such as -5 is left alone.
Line endings
RFC 4180 specifies CRLF, which Excel on Windows expects. LF is the plainer file and is read by everything else. There is no line break after the last row.

Worked examples

  • Tab separated3 columns, quoted where needed
    Wrench,2,"8mm, steel"
  • Fixed widthWidths 10, 5, 20, columns cut at the widths
    Wrench,2,"8mm, steel"
  • Ragged line2 fields not 3, the row flagged and kept
    Hammer,1

The text and the settings are remembered in this browser alone, so they are still here when you come back. Start over, above the tool, forgets them. A paste longer than 20,000 characters is converted in full but is not written to storage. One pass reads up to 2,000,000 characters and writes up to 200,000 rows and 1,000 columns.

Accuracy. Exact conversion under the settings you choose, quoted by RFC 4180 so a comma or a quotation mark inside a field survives. A line that does not fit the column count is reported rather than silently dropped or padded.

Common questions

How do I convert text to CSV?
Paste the text into the box on the left. It is read as tab separated to start, which is what text copied out of a spreadsheet looks like, and the CSV appears on the right as you type. If your text uses something else, pick it on the delimiter strip: comma, semicolon, vertical bar, space, any run of spaces, or a character you type yourself. Copy puts the whole file on your clipboard and Download writes it as converted.csv.
What is the difference between a delimiter and fixed width?
A delimiter is a character that sits between the fields, so the line is cut wherever that character appears. Fixed width has no such character: the columns are a certain number of characters wide, the way a printed report or a mainframe export is laid out, so you type the widths instead, for example 10, 5, 20. Anything left over past the last width becomes one more field rather than being thrown away, and a line that stops before the widths run out is listed with its length so you can see which lines were short.
What happens to a line with the wrong number of fields?
It is converted and then named. The column count comes from the header row, from the first row when the header setting is off, or from the widths you typed in fixed width mode, and any line that does not match is written into the CSV exactly as it was read and listed below the readout with its line number and its field count. A row is never dropped and a field is never cut off the end. Pad short rows to the column count is a switch, off to start, and a row it pads is still listed with what the padding did.
Does a comma or a quote inside a field survive?
Yes, that is what the RFC 4180 quoting is for. A field holding a comma, a double quote, a carriage return or a line feed is wrapped in double quotes, and any double quote inside it is written twice, so 8mm, steel comes out as "8mm, steel" and he said "yes" comes out as "he said ""yes""". A spreadsheet reads both back as the single value you started with. Quote every field is there as well for importers that expect it, and wrapping a field that did not need it is still valid CSV.
What does the header setting do?
It says that the first row holds the column names. That row is written out as the first line of the CSV, and its field count is the number every other row is measured against. With the setting off, no names are invented and no row is spent on them: every line is data, and the first row sets the column count instead. In fixed width mode the widths set it either way. The Header cell in the readout says which of the two is on.
My text already has quotes in it. Will they be doubled up?
Only if you leave the already quoted setting off, because then a quotation mark is just a character in a field. Switch on the text already uses quotes and the pasted text is read by the RFC 4180 rule too, so a quoted field may hold the delimiter or even a line break and comes back as one field. That reader needs a single character delimiter, and a quote that never closes is refused with the line it opened on rather than guessed at.
How do I stop Excel running a field as a formula?
Switch on the apostrophe setting. A field that starts with =, +, - or @ is given a leading apostrophe, which is how a spreadsheet is told to store what follows as text. A field that is a plain number is left alone, so -5 stays the number minus five and only something like -5+3 is guarded, and the line under the readout says how many fields were changed. The setting is off to start, because it does change your values. Line endings are the other Excel detail: LF is the default and CRLF, which RFC 4180 specifies, is one click away.
How much text can it take, and is any of it uploaded?
One pass reads up to 2,000,000 characters and writes up to 200,000 rows, 1,000 columns and 2,000,000 characters of CSV. Those are memory limits rather than a plan, and they are enforced honestly: the size of the file is worked out from the written fields before it is built, so a paste past the cap tells you how many rows did fit instead of handing back a file that was cut short. Nothing is uploaded. The conversion runs in your browser, the text and the settings are remembered in this browser alone, and Start over above the tool forgets them. A paste longer than 20,000 characters is still converted in full but is not written to storage.

Exact conversion under the settings you choose, quoted by RFC 4180 so a comma or a quotation mark inside a field survives. A line that does not fit the column count is reported rather than silently dropped or padded.