How to use the fixed width to csv converter
- Paste the fixed width text, where each column starts at the same character position on every line.
- Choose how to find the columns: detected from the text, start positions (counting from 1) or column widths.
- For the last two, type the numbers into Positions or widths, such as 1, 7, 23, 35.
- Check the ruler under the result to see where the cuts fall, then copy the CSV or download it.
A four column report
In the starting text, ID, NAME, CITY and BALANCE start at positions 1, 7, 23 and 35. Detection finds them because the characters between the columns are spaces on every line. The result is a header ID,NAME,CITY,BALANCE followed by rows such as 1001,Ana Diaz,Austin,120.50.
The same cuts come from start positions 1, 7, 23, 35 or from widths 6, 16, 12, 10. The widths add up to the starting positions: each column starts where the previous one ends. Trim spaces removes the padding around each cell, and cells that contain commas or quotes are quoted in the CSV.
How detection works
Detection looks for character positions where every non-blank line has a space or has already ended. A column starts at the first position after such a gap. It works well for reports with clear gaps between columns, but cannot split two columns with no space between them, or a column that is blank on every line. For those, give the positions yourself.
Lines shorter than a column start give empty cells. Blank lines are skipped by default, which suits reports with spacing between sections.
Getting positions right
Use a font where every character has the same width, such as the one in the box, so that columns line up the way the file does. Position 1 is the first character of a line. A tab counts as one character, so if the file uses tabs, change them to spaces first. When the file has column positions in its documentation, choose start positions or widths and type them in. Once you have a CSV, the CSV and JSON Converter, Change CSV Delimiter, CSV Transpose Tool and CSV Validator can take it further.
Assumptions and limits
- Each character counts as one position. Wide characters such as some emoji are not given extra width.
- Up to 100,000 lines are accepted, with up to 200 columns. Everything runs in your browser.
- Detected columns need at least one gap of spaces that is blank on every line.
- The output uses commas, quotes cells that need it and ends lines with a single line feed.
Frequently asked questions
What is fixed width text?
It is text where each field takes a set number of characters and shorter values are padded with spaces. Many older systems and mainframe reports use it instead of delimiters.
Do positions start at 0 or 1?
They start at 1, so the first column of a file usually starts at position 1. The ruler below the result helps check the cuts against your text.
What if a value is wider than its column?
The text is cut at the next column start, so the extra characters go into the next cell. Widen the column or fix the positions, and check the ruler to see where the cut falls.
Can I choose widths instead of positions?
Yes. Choose Column widths and enter the width of each column. The page converts them into start positions by adding the widths one after another.