Skip to content
ZeroServer.tools

Fixed Width to CSV

Convert fixed-width columnar text to CSV. Auto-detect column breaks or specify widths manually.

or drop a file here
CSV output

How fixed-width to CSV conversion works

Fixed-width files store data in columns of fixed character widths, common in legacy mainframe exports. The auto-detect mode scans each row for columns where all rows have whitespace (a common column separator pattern) and uses those positions as field boundaries. Manual mode lets you specify exact widths separated by commas. Fields are trimmed and CSV-quoted if they contain commas or double-quote characters.

Built and maintained by Meet Shah · Last updated

What this tool is used for

  • Converting a mainframe or legacy report extract into something a spreadsheet can read.
  • Turning aligned console output into structured columns.
  • Parsing a fixed-width bank or payroll file into CSV for analysis.
  • Extracting columns from a text report with no delimiters.
  • Checking whether auto-detected column breaks match a documented layout.

Frequently Asked Questions

How does automatic column detection work?
It looks for character positions where every single line has a space, and treats each run of those as a gap between columns. That is why it needs at least two lines to work, and why a file whose columns are separated by exactly one space in one row will detect correctly and one where a value fills the gap will not.
When should I switch to manual widths?
Whenever a value runs the full width of its column, closing the gap that detection depends on — long names and addresses are the usual culprits. Mainframe and COBOL extracts normally ship with a record layout giving each field's width, and typing those in is both faster and exact.
Why does fixed-width need no escaping?
Because position defines the field, so a comma or a quote inside a value is just another character. That is the format's real advantage over CSV, and its real limit: nothing can exceed its allotted width, so a value that overflows either truncates or corrupts every field after it.
Is padding stripped from the values?
Yes, each sliced field is trimmed. Fixed-width data conventionally left-aligns text and right-aligns numbers, both padded with spaces, and neither padding carries meaning. Zero-padded numeric fields are different — those zeros are part of the value and survive, since only whitespace is removed.
What happens to lines shorter than the layout?
Missing positions are read as spaces, so a truncated final line yields empty trailing fields rather than an error. Watch for it: a file that ends mid-record will convert cleanly and quietly produce a row of blanks at the bottom.

Common errors and gotchas

  • Trusting auto-detected breaks over a documented layout, where one short row can shift a boundary.
  • Assuming character positions equal byte positions, which breaks for any multi-byte character.
  • Losing significant leading zeros when a numeric column is trimmed.
  • Overlooking a continuation or a footer line that does not follow the column layout.
  • Trimming trailing spaces that were part of a fixed-width value's meaning.

Related Converters tools

Private & free — this tool runs entirely in your browser.

IndieKitShip your Next.js startup in days.affiliate