Fixed Width to CSV Converter
Mainframe dumps, COBOL print files, government filings, and legacy batch reports often arrive as fixed-width text: every field occupies the same character columns on every line, padded with spaces so values line up visually in a monospace font. Spreadsheets and modern pipelines expect CSV. This free fixed-width to CSV converter reads that column-aligned paste in your browser, infers field boundaries from whitespace alignment (especially when a header row is present), and emits clean comma-separated rows you can open in Excel, Google Sheets, or another converter on this site.
Paste a report excerpt or upload a plain-text .txt extract. The tool looks across lines for consistent column starts, treats a well-spaced header line as strong evidence for where fields begin and end, and projects each slice into a CSV cell. Conversion runs entirely client-side — your report text is not uploaded to a server as part of the transform.
Below you will find how fixed-width layout differs from CSV and TSV, how auto-detection uses header alignment, why tabs can trick you into thinking a file is fixed-width when it is really tab-separated, how to strip page headers and footers before converting, Excel pitfalls after download, reverse conversion with CSV to Fixed Width, and a full troubleshooting and FAQ section for real mainframe-to-spreadsheet workflows. Use the preview as your source of truth before you download or share the file.
Key features
- Auto-detects field boundaries from whitespace alignment across rows, without requiring a hand-written column map for typical reports.
- Uses header rows when present to name CSV columns and to reinforce where each field starts and ends.
- Trims space padding from cells so CSV values are ready for spreadsheets and downstream converters.
- Handles common mainframe-style and government column-aligned text pastes in the browser.
- Runs entirely client-side so report contents are not sent to a server for the conversion step.
- Produces standard CSV ready for Excel, Google Sheets, or further tools on this site.
- Pairs with CSV to Fixed Width for round-trips back to positional layouts when a legacy system demands them.
About the fixed-width text to CSV format
Fixed-width (also called column-aligned or positional) text stores each field in a reserved character range: for example, characters 1–10 for a name, 11–14 for an age, and 15 onward for a city. Spaces pad shorter values so columns appear as vertical bands when viewed in a monospace editor. There is usually no delimiter between fields — position is the contract.
CSV is a delimited grid: a header row of field names, then one record per line with commas (and quoting rules) separating cells. Conversion means deciding where each fixed field starts and ends, trimming padding, and writing those slices as CSV columns. When a header row such as NAME, AGE, and CITY is already space-aligned above the data, those labels become natural CSV headers and sharpen boundary detection.
Auto-detection scans multiple lines for shared whitespace “gutters” — vertical runs of spaces that separate fields consistently. Header rows help because labels are short tokens sitting above the columns they name. Tabs are not the same as space padding: a tab-delimited paste may look column-aligned in some editors but is really TSV; treat that as a different format rather than forcing fixed-width rules.
How it works
The converter reads your pasted lines as a character grid. It looks for vertical gutters — columns where spaces appear consistently across many rows — as candidate field boundaries. A header line with short, space-separated labels strongly reinforces those cuts and supplies CSV column names.
Each data line is sliced at the inferred boundaries. Leading and trailing padding inside a slice is trimmed so cells contain the meaningful value (for example Alice, 30, New York) rather than full-width space-padded blocks.
The result is escaped for spreadsheet use and shown in preview. You copy or download CSV once the columns match the report. If detection looks wrong, remove non-data lines (titles, page numbers, separators) and try again with a cleaner block that includes the header.
Common use cases
- Converting a COBOL or mainframe print report into CSV for analysis in Excel or Sheets.
- Extracting column-aligned government or regulatory text filings into a spreadsheet.
- Turning a legacy batch .txt dump with space-padded fields into CSV for a modern dashboard.
- Preparing fixed-width bank or payroll extracts for import into a system that only accepts CSV.
- Cleaning a monospace email attachment report so teammates can filter and chart the rows.
- Spot-checking positional layouts during a migration from mainframe exports to cloud ETL.
How to use this tool
- Open the report in a monospace editor, copy the header plus data rows, and remove page headers, footers, and decorative separator lines.
- Paste the block into the converter (or upload a .txt excerpt) and confirm the preview shows the intended columns.
- Check that tabs were not mistaken for spaces — if fields were tab-separated, use a TSV/CSV path instead.
- Rename or drop any spurious columns, then copy or download the CSV.
- Open a sample in Excel or Sheets and verify long text fields, numeric IDs, and empty columns.
Example
Input fixed-width text
NAME AGE CITY
Alice 30 New York
Bob 25 ChicagoOutput CSV
NAME,AGE,CITY
Alice,30,New York
Bob,25,ChicagoTips for best results
- Paste with a clear header row when possible — aligned labels make boundary detection far more reliable.
- View the source in a monospace font so you can see true column alignment before converting.
- Strip repeating page headers, footers, and form-feed page breaks before pasting the data block.
- If the paste uses tabs between fields, it may be TSV — convert as tab-separated data instead of fixed-width.
- Spot-check a few rows in the preview: names with spaces inside a field should stay in one CSV column.
- Trim trailing blank columns if the detector over-split sparse right-hand fields.
- Use CSV to Fixed Width when you need to go back to a positional layout for a legacy importer.
- Keep the original text until row counts and a few edge rows (long names, empty fields) look right.
Common errors and how to fix them
- Columns split in the wrong places — for example a city name is cut in half or age merges into the name.
- Remove non-data lines (titles, page headers, footers, underlines) so only the aligned header and records remain. Ensure the paste uses spaces consistently and that you are viewing it in monospace. A clear header row usually fixes weak detection on sparse data.
- The text looked aligned in my editor but converts as one or two broken columns.
- The file may use tab characters between fields. Tabs expand to different widths in different viewers, mimicking fixed columns without being positional. Check for tabs; if present, treat the paste as TSV rather than fixed-width.
- Every page of a long report adds a repeated title or page number into the CSV as fake rows.
- Strip repeating page headers and footers before converting. Fixed-width detectors assume every line is a data (or header) record; banner lines destroy alignment statistics and pollute the output.
- Empty fields or short values cause the next column to shift left in some rows.
- True fixed-width rows must preserve padding so character positions stay constant. If your export already trimmed spaces inside the line, positional layout is broken — restore padding from the source system or supply an explicit column map if your workflow supports one.
- Special characters or accented letters appear wrong after download.
- Save and paste as UTF-8 when possible. Legacy EBCDIC or code-page exports should be transcoded to UTF-8 before conversion. Spreadsheet apps may also need an explicit UTF-8 import if the OS locale assumes another encoding.
- I need to send data back to a system that only accepts fixed-width files.
- Use the CSV to Fixed Width converter after you finish editing in a spreadsheet. Define widths that match the legacy layout, then verify in a monospace viewer that columns realign before upload.
Best practices
- Always include the header row when the report has one — labels both name columns and guide boundary detection.
- Clean the paste to a rectangular data region: no cover pages, no page numbers, no dashed rules between sections.
- Distinguish tabs from spaces before you convert; do not force fixed-width logic onto TSV.
- Spot-check rows with the longest values in each field to confirm slices did not truncate mid-token incorrectly.
- Keep original fixed-width text until stakeholders accept the CSV row count and a few edge cases.
- Document the source report name, extract date, and assumed column meanings when the file informs a decision.
- For recurring monthly dumps, note whether widths ever change — layout drift will silently mis-slice columns.
What fixed-width to CSV conversion actually does
Fixed-width files are contracts written in character positions. Humans read them in monospace; machines that expect CSV need commas and a header. This conversion finds where fields live on each line, trims padding, and writes a delimited table.
You keep labels and values, not printer control codes, carriage-control columns from some mainframe listings, or visual underlines — those should be removed before paste when they are not data. The goal is a spreadsheet-friendly grid that matches the logical columns of the report.
It is not a full ETL platform: it does not connect to a mainframe, interpret COBOL copybooks automatically, or apply packed-decimal binary layouts. You paste (or upload) already-decoded plain text that looks column-aligned.
When to convert fixed-width text to CSV
Convert when a legacy report is only available as positional print text, when a government or vendor portal offers a .txt layout without CSV, or when analysts need to filter and chart columns that are trapped in a monospace dump.
Skip conversion if the producer already offers CSV or a documented API — prefer the authoritative delimited feed. Skip if the “alignment” is really tabs or a variable-width export with inconsistent padding; fix the format first.
A practical pattern: strip headers and footers, convert to CSV, clean names in the Online CSV Editor, then feed JSON, SQL, or Excel converters as needed.
- Good fit: COBOL print files, mainframe listings, space-padded gov reports, batch .txt extracts.
- Poor fit: tab-separated exports, PDFs without text extraction, binary VSAM/EBCDIC without decoding.
- Better as a script: nightly warehouse loads with a published copybook and fixed byte offsets.
How auto-detection uses whitespace and headers
Detectors look for columns that are “mostly space” down the page — gutters between fields. When many rows share the same gutter positions, those indices become split points. Sparse right-hand columns or ragged last fields can be harder; trimming trailing empty slices after conversion is common.
A header such as NAME, AGE, and CITY sitting above the data is especially helpful. Short tokens leave clear gaps, and the same gaps usually continue through Alice / 30 / New York style rows. Without a header, the tool leans more heavily on data-row consensus alone.
If two fields are adjacent with only a single space and values often fill the entire width, gutters weaken. In those cases, paste a larger sample of rows so statistics stabilize, or pre-clean obvious junk lines that do not follow the layout.
Tabs versus spaces: TSV is not fixed-width
Space-padded fixed-width keeps every field at a constant character index. Tab-separated values insert a tab character between fields; editors expand tabs to the next tab stop, which can look like neat columns even though the underlying bytes are delimiters, not padding.
If you convert true TSV with fixed-width logic, splits will be wrong whenever values differ in length. Check for tabs in a hex view, an editor that shows whitespace, or by searching for \t. When tabs are the separators, use a CSV/TSV importer path instead of this tool.
Mixed files exist: some legacy extracts use tabs in one section and spaces in another. Split the paste so each region uses one convention before converting.
Page headers, footers, and report chrome
Print-oriented reports repeat titles, run dates, department names, and page numbers every N lines. Those lines do not share the data column layout. Leaving them in the paste poisons gutter detection and inserts garbage rows into CSV.
Dashed or equals-sign separator lines, form-feed characters, and “continued on next page” banners should go too. Aim for one header line plus contiguous data lines that all obey the same positions.
For multi-page pastes, it is often faster to delete chrome in an editor with regex (for example lines matching PAGE or a known title) than to fix a polluted CSV afterward.
Mainframe, COBOL, and government report quirks
COBOL and mainframe print files may include a leading carriage-control column, RECFM quirks, or dump wrappers from transfer tools. After FTP or iconv to a desktop encoding, you should see plain readable text with stable columns before pasting here.
Government and regulatory fixed layouts sometimes publish a separate data dictionary (start position and length per field). Auto-detection approximates that dictionary from alignment; for mission-critical filings, spot-check against the published offsets when they exist.
Packed fields, COMP-3, and binary records are out of scope until decoded to character form. This converter expects text you can already read in a monospace editor.
Empty fields, padding, and values with internal spaces
Empty numeric fields are often all spaces in the source. After trim, CSV cells become empty — which is usually what you want. Do not delete the padding in the source before conversion or neighboring fields will shift.
Values with internal spaces (New York, Los Angeles, last names with suffixes) must stay inside one slice. Correct boundaries put the entire city in one column; over-aggressive splitting on every space is a sign the detector saw too many gutters — often from uneven paste or mixed tab/space content.
Leading zeros in account or case IDs survive better in CSV text than in Excel’s default open behavior. Plan to format those columns as Text after download when zeros matter.
Excel, Sheets, and after-download cleanup
CSV opens widely but Excel may auto-convert values that look like dates or numbers. Import with a wizard or set ID columns to Text when needed.
If everything landed in one column, your locale may expect semicolons — use Text Import with comma selected. Google Sheets usually handles UTF-8 CSV uploads well.
Rename headers to match your data dictionary, drop trailing empty columns, and remove any leftover non-data rows before charting or feeding another converter.
Typical workflows
Ops export: download a nightly fixed-width dump, strip headers/footers, convert to CSV, archive both the raw text and the sheet.
Analyst request: paste a government table excerpt, convert, and share a filtered CSV without granting mainframe access.
Migration rehearsal: convert sample positional files, validate column meanings, then automate with a copybook-aware pipeline later.
Round-trip edit: convert to CSV, clean in Sheets, then CSV to Fixed Width to satisfy a legacy upload portal.
Browser limits, privacy, and sensitive reports
Parsing is local. Pasted report text is not sent to Convert CSV servers for the transform. Site analytics and advertising follow the privacy policy separately.
Huge multi-megabyte dumps can slow the tab. Convert a representative sample or one logical section first; use offline scripts for warehouse-scale files.
Payroll, tax, health, and case reports often contain PII. Even with local conversion, control who receives the CSV, redact when sharing externally, and clear downloads on shared machines.
Fixed-width to CSV versus copybook-driven ETL
Enterprise ETL with a COBOL copybook or flat-file schema wins for production loads: exact offsets, typed fields, rejection handling, and scheduling. That is the right long-term path for recurring feeds.
This converter wins for one-off analysis: you have a print-style .txt, no copybook handy, and you need a spreadsheet in minutes. It also helps you discover approximate column layouts before you formalize a schema.
If you convert the same report every week, treat that as a signal to capture official widths and automate — keep this tool for ad hoc extracts and layout exploration.
Quality checklist before you share the CSV
Confirm row count roughly matches data lines (excluding removed headers and footers). Confirm headers are meaningful. Spot-check a long name and an empty field.
Verify you did not convert TSV by mistake. Open in the recipient’s spreadsheet app. Note the source report and extract date when the file informs a decision.
- Non-data chrome removed before convert.
- Tabs ruled out (or handled as TSV instead).
- Header labels correct and complete.
- Internal spaces (e.g. city names) stayed in one column.
- Source report/date recorded when needed.
CSV to Fixed Width: the reverse path
After editing in Excel or Sheets, many legacy portals still demand positional upload files. CSV to Fixed Width pads and truncates columns to specified widths so the text realigns in monospace.
Match widths to the receiving system’s specification, not merely to what auto-detection inferred on the way in — detection approximates layout; the importer’s rules are authoritative on the way out.
Round-tripping can change padding and truncation behavior. Keep a golden sample from the vendor when compliance depends on exact bytes, and compare your regenerated file in a monospace diff before production upload.
Related tools and next steps
Need to rebuild a positional file after spreadsheet edits? Use CSV to Fixed Width. Cleaning headers and blank rows is easiest in the Online CSV Editor before you chain into JSON, SQL, or Excel converters.
If your paste turns out to be comma- or tab-delimited already, skip fixed-width detection and use the appropriate delimited import path. Site guides cover Excel import quirks when the open step — not the slice step — is what misbehaves.
Frequently asked questions
Do I need a COBOL copybook or column map to use this?
No. For typical space-aligned reports the converter infers boundaries from whitespace and optional headers. For production ETL you should still validate against an official copybook or data dictionary when one exists.
Why does a header row help so much?
Header labels are short tokens sitting above each field, which creates clear vertical gutters and supplies CSV column names. Data-only pastes can still work, but detection is usually stronger with the header included.
My file looks aligned but uses tabs — will this work?
Probably not reliably. Tab-separated data should be handled as TSV/CSV, not as fixed-width positions. Confirm whether separators are tabs or spaces before converting.
How do I handle page headers and footers?
Delete them before pasting. Repeating titles, page numbers, and separator lines break alignment heuristics and create junk CSV rows.
Is my report text uploaded to a server?
No. Conversion runs in your browser. See the Privacy Policy for site analytics and advertising.
Can I convert CSV back to fixed-width?
Yes. Use the CSV to Fixed Width converter to pad columns to the widths your legacy system expects.
What about EBCDIC or binary mainframe files?
Decode to readable character text (typically UTF-8) first. This tool does not interpret EBCDIC packed fields or binary record layouts.
Why are city names like New York splitting into two columns?
Boundaries are too aggressive or the paste mixed spaces and tabs. Clean chrome lines, ensure consistent space padding, and retry with the header row present so the city field is one slice.
Is there a file size limit?
There is no fixed server quota, but very large dumps can slow the browser. Convert a section or sample first for huge files.
Will leading zeros in IDs be preserved?
They remain in the CSV text, but Excel may drop them on open. Import as Text or use an import wizard for those columns.
Can the tool read PDF report scans?
No. You need selectable plain text that is already column-aligned. OCR or PDF text extraction must happen before pasting here.
How do I turn the CSV into JSON or SQL next?
Use the CSV to JSON or CSV to SQL converters on this site after you are happy with the fixed-width extract.
For more background on data formats and conversion workflows, read our format guides or browse the converter blog for step-by-step walkthroughs linked to each tool.