Fixed Width ↔ CSV Converter
Convert between fixed-width (positional) text and CSV format with column definitions, auto-detection, and live preview.
About This Tool
The Fixed Width to CSV Converter is a free browser-based tool that transforms fixed-width (positional) text files into CSV format and back. Fixed-width files are a legacy data format where each field occupies a specific number of characters in every line. They are still widely used in banking, government systems, mainframe exports, COBOL programs, and EDI transactions.
This tool lets you define column boundaries by specifying a name and character width for each field. You can also auto-detect column boundaries from aligned text — the algorithm analyzes whitespace patterns across lines to find consistent break points. A visual column ruler displays the exact character positions so you can verify your layout matches the data.
Both conversion directions are supported. In Fixed Width to CSV mode, the tool slices each line according to your column definitions, trims whitespace (optionally), and outputs standard comma-separated values. In CSV to Fixed Width mode, it reads CSV input, pads each field to the specified width using spaces or zeros, and aligns left or right per column.
All processing happens entirely in your browser. No data is uploaded to any server — making it safe for sensitive financial records, medical data, or proprietary file formats. If you are working with tabular data in other formats, you may also find the CSV to JSON converter or the Text Column Aligner useful. For structured data transformations, check out the JSON Formatter.
How to Use
- Select the conversion direction: Fixed → CSV or CSV → Fixed.
- Define your columns in the Column Definitions panel — set each column's name, character width, alignment, and trim option.
- Alternatively, paste fixed-width text and click Auto-detect to let the tool infer column boundaries automatically.
- Paste your input data into the Input panel.
- Review the parsed data in the Preview table below the panels.
- Check the Column Ruler to verify character positions match your data layout.
- Click Copy or press Ctrl+Shift+C to copy the output, or click Download to save as a file.
Popular Fixed Width / CSV Examples
FAQ
What is a fixed-width file?
A fixed-width (or positional) file is a text file where each field in a record occupies a fixed number of characters. There are no delimiters between fields — the position and length of each field define its boundaries. For example, characters 1-10 might be an account number, 11-40 a name, and 41-52 a balance. This format is common in mainframe systems, COBOL programs, banking files (NACHA/ACH), government data feeds, and EDI transactions.
How does auto-detect work?
The auto-detect algorithm scans all lines in your input and counts how many lines have a space at each character position. Positions where a high percentage of lines (70% or more) have spaces are identified as potential column boundaries. The tool then groups consecutive space positions into gaps and uses the transitions between gaps and non-gaps to define column start positions and widths.
Can I handle right-aligned numeric fields?
Yes. Each column definition includes an alignment option (left or right). For numeric fields that are right-justified with leading spaces or zeros, set the alignment to 'right'. When converting CSV to fixed-width, the tool will pad the value on the left side. When converting fixed-width to CSV with trim enabled, leading spaces or zeros are removed.
What padding characters are available?
When converting CSV to fixed-width, you can choose between space padding (the default) and zero padding. Space padding is standard for text fields, while zero padding is common for numeric fields in financial file formats like NACHA/ACH files.
Is my data safe?
Yes. All parsing and conversion runs entirely in your browser using JavaScript. No data is sent to any server. You can verify this by checking the Network tab in your browser's developer tools while using the tool. This makes it safe to use with sensitive financial, medical, or proprietary data.
How do I handle files with a header row?
Fixed-width files typically do not have a CSV-style header row. Instead, the column structure is defined externally (e.g., in a copybook or specification document). In this tool, you define column names in the Column Definitions panel. When converting fixed-width to CSV, the tool automatically adds a header row using your column names. When converting CSV to fixed-width, the header row from the CSV is used to map columns.
What are the presets for?
The presets provide common fixed-width layouts with sample data so you can quickly see how the tool works. The COBOL Copybook preset uses a typical mainframe record layout, the Bank Statement preset mimics financial statement formats, and the Log File preset shows server log parsing. Click any preset to load its column definitions and sample data.
Related Tools
CSV ↔ JSON Converter
Convert between CSV and JSON formats with delimiter selection, header toggle, and file drag-and-drop.
Text Column Aligner
Align text into neatly formatted columns with customizable delimiters, per-column alignment, and live preview.
JSON Formatter
Format, validate, and beautify JSON with syntax highlighting and tree view.
Markdown Table Generator
Build Markdown tables visually with an interactive editor. Add rows, columns, set alignment, and copy the output.