Developer and Text Tools

How to Convert a Fixed-Width Text File to CSV or Excel

Read bank, payroll and mainframe flat files: set column positions on a ruler, decode COBOL signed numbers and EBCDIC, and save the layout.

Saizul Amin
Saizul Amin2 Nov 2026 · 4 min read
How to Convert a Fixed-Width Text File to CSV or Excel

How to Convert a Fixed-Width Text File to CSV or Excel

If you work in finance, payroll, insurance or with any older corporate system, you have probably received a text file where everything is squashed together: an account number, a date and an amount in one line with no commas. These are fixed-width files, and they are still everywhere because mainframe programs and many bank interfaces produce them. This guide explains how they work and how to turn them into a proper table with the Fixed-Width Text File Parser.

How fixed-width files are built

In a fixed-width file each field always occupies the same character positions. The account number might be characters 2 to 13, the posting date 15 to 22 and the amount 47 to 55. Short values are padded with spaces or zeros. The positions are defined in a record layout document, often called a file specification or copybook, and the file itself contains no hint of where one field ends and the next begins. That is why opening it in a spreadsheet gives one long column.

Finding the column breaks

If you have the specification, type the start positions into the break list and you are done. Without it, the ruler helps. The first lines of the file are drawn in a monospaced font under a character scale. Tap between two characters to add a break and tap a red line to remove it. Coloured bands show the resulting fields. Press detect breaks to let the tool find positions where every line has a blank column; this works well for report-style files with spaces between fields and gives a starting point for packed files. Check a few lines with long values before trusting the result.

Headers, trailers and record types

Many flat files begin with a header record and end with a trailer that holds record counts and totals. Skip them with the top and bottom line settings. Files that interleave several record types are common in banking: an H line for the account, D lines for transactions and a T line for totals, with the type in the first character. Set the record type position, length and value, and only matching lines become rows. Skipped lines appear faded on the ruler so you can see the effect immediately.

Numbers the COBOL way

Mainframe numbers often have no decimal point. The specification will say something like 9 digits with 2 implied decimals, so 000012345 means 123.45. Set the implied decimals on the field and the conversion is done. Signed numbers are trickier: COBOL stores the sign inside the last character, a format called zoned decimal or overpunch. An opening curly bracket or the letters A to I mean a positive last digit 0 to 9, a closing curly bracket or J to R mean a negative one. So an amount ending in J is negative and ends in 1. Choose the signed zoned decimal type and the tool decodes it. Plain number fields also understand trailing minus signs, brackets and CR markers for credits.

Dates and encodings

Packed dates such as 20261031 or 311026 become ISO dates when you choose the matching layout. Files from IBM mainframes may be in EBCDIC rather than ASCII, in which case the text looks like random symbols; switch the encoding to EBCDIC code page 037 and it becomes readable. Mainframe extracts may also lack line breaks entirely, with every record exactly 80 or 120 characters long, so enter the record length and the file is cut into lines.

Save the layout once

Once the preview table looks right, name the layout and save it in the browser or download it as a JSON file. The layout includes the breaks, field names, types, decimals, skipped lines and record filter, so next month's file needs one click. Export the result as XLSX with real numbers, or as CSV for loading into another system.

A few cautions

Binary packed decimal fields, known as COMP-3, cannot be represented as text and must be unpacked by the sending system first. Always reconcile the converted totals with the trailer record: if the file says it contains 1,204 detail records totalling a certain amount, your table should agree. That simple check catches a misplaced break faster than any amount of eyeballing.

Completely freeNo cost, no sign-up
Files stay privateEverything runs in your browser
Easy in your languageAvailable in many languages