Skip to content
AZ Tools

Fixed-Width Text Parser to CSV / JSON

Split fixed-width / fixed-column text into fields by column widths and export as CSV or JSON, in your browser.

Result

How to use

  1. Paste your fixed-width text, one record per line.
  2. Enter the column widths separated by spaces or commas (e.g. 6 3 8).
  3. Choose CSV or JSON output and toggle trimming.
  4. For JSON, enable 'first row is header' to key objects by column name, then copy the result.

About this tool

Show

Parse fixed-width records — the format banks, payroll systems and mainframe exports still hand out — by giving the column widths and reading structured rows back as JSON or CSV. There are no delimiters in a file like this: every field is found by its position, which is why a single missing space shifts everything after it and why a spec sheet is not optional. Widths here are counted in characters, so a file with accented names or CJK text lines up if the spec was written in characters and will not if it was written in bytes. Fields can be trimmed of their padding, and the first row can be treated as a header so the JSON comes out with real keys instead of numbered columns. Everything runs locally in your browser.

Frequently asked questions

How do I know the column widths?

Count the characters each column occupies in the source layout, including padding spaces. Most fixed-width specs document the widths; you can also align the text in a monospace editor and count.

What happens if a line is shorter than expected?

Fields past the end of a line come out empty. Lines longer than the total width have the extra characters ignored.

How is the CSV quoted?

Fields containing a comma, double quote or line break are wrapped in double quotes, and inner quotes are doubled, following RFC 4180.

Is my data uploaded?

No. Parsing happens entirely in your browser; nothing leaves your device.

The columns drift partway down the file. What happened?

One record is a character out, and everything after it inherits the shift because every field is found by position. Look for a value that overflowed its field, a stray tab that a viewer shows as several spaces, or a line where an accented character was counted as one byte by the writer and one character here.

Is the spec in bytes or characters?

Widths here are characters. Mainframe layouts were written when a byte and a character were the same thing, which they still are for plain ASCII data — but a file carrying accented names or CJK text in UTF-8 has more bytes than characters, so a spec written in bytes will not line up until the file is converted or the widths adjusted.

Related tools