Fixed-Width ↔ CSV/JSON Converter
Converts fixed-width text files to CSV, TSV or JSON and back, with automatic column detection, a position map and per-line warnings.
Widths mode: name:14,state:2 — one width per column, in order. Positions mode: name:1-14,state:15-16 — 1-indexed and inclusive on both ends.
How the two specification modes differ
Widths mode adds up as it goes: name:14,state:2,amount:10 means characters 1 to 14, then 15 to 16, then 17 to 26. Positions mode names the start and the end of each field, so you can skip filler columns and read only what matters — useful when the layout document lists 60 fields and you need four of them.
Automatic detection looks for character columns that are blank on every single line and treats runs of two or more as separators. It fails on layouts where a value touches the next field, and it will merge two columns whose gap is a single space. When that happens, take the generated position map, fix the boundary by hand and convert again.
Convert fixed-width files to CSV and back
A fixed-width file has no separator: every field takes an exact number of characters and the leftover space is padded with blanks or zeros. Bank return files, mainframe extracts and the TXT many ERPs produce instead of a CSV all look like that, and a spreadsheet opens them as a single column. Describe the layout once, as name:14,state:2,amount:10, and get CSV, TSV or JSON out.
Widths mode adds fields up in order: 14 characters for the name, 2 for the state, 10 for the amount. Positions mode names the start and end of each field, so you can skip filler and read four fields out of a sixty-field layout. Automatic detection looks for character columns that are blank on every line and treats runs of two or more as separators, which is why it merges two fields parted by a single space.
Going the other way, the CSV becomes positional again: each field is padded to the declared width, with trailing spaces or leading zeros, the way numeric fields are usually written in transmission files. A value that does not fit is cut off, and the tool reports the line, the field and the original length. Finding that here beats finding it in the rejection report a day later.
Frequently asked questions
What happens when a line is shorter than the layout?
Does automatic detection work on every file?
Is my data uploaded anywhere?
Related Tools
CSV to JSON
Convert CSV to JSON. The first row becomes object keys, the rest become array items. Supports separators , ; and \t. Auto-detects numbers and booleans. Everything in your browser.
CSV → JSON Lines
Convert CSV to JSONL (one JSON object per line). Common format in logs, ML pipelines and document databases.
JSONP to JSON Converter
Strips the callback wrapper of a JSONP response leaving only the JSON contained inside the parentheses.