Fixed-width and CSV converter
Split fixed-width records by explicit Unicode code-point widths, or pad CSV fields into a fixed-width text file.
- 1Add input
- 2Adjust settings
- 3Get your result
Tool input and files are processed in this browser without being uploaded.
Before you start
Convert a legacy text export without trimming its field spaces. Supply the field names and widths, inspect complete records, and download the receiving format.
How to use this tool
- Choose a direction and paste the records, or open a local UTF-8 export.
- Enter widths JSON in field order. Count code points and include meaningful spaces; do not infer widths from a proportional-font preview.
- Check the field preview and spreadsheet-protection setting, then copy or download the complete CSV/text result.
Supported inputs and limits
One UTF-8 file or pasted source up to 1 MiB, plus widths JSON up to 1 MiB. A selected file takes precedence. At most 10,000 records, 100 fields, 1,000 code points per field and 10,000 per complete record. UTF-8 BOM is omitted.
Widths count Unicode code points, not bytes, display columns or grapheme clusters. An emoji is one code point; combining marks count separately. Each fixed-width line must have exactly the declared total width. No leading/trailing spaces are trimmed.
The secondary JSON is an array of {name,width} objects with unique nonempty names and positive integer widths. CSV requires the same headers in the same order and at most 200,000 input cells including headers. CSV to fixed-width rejects overflowing or multiline cells, pads on the right with ASCII spaces and uses LF record endings.
CSV downloads use spreadsheet protection by default: formula-like cells gain a leading apostrophe. Disable it explicitly when you need unchanged field text. Preview shows up to 200 records; downloads contain every record.
Worked example
Example input
0001Ada 0002张三
Example options
{"params": {"direction": "to-csv", "spreadsheetSafe": false}, "secondary": "[{\"name\":\"id\",\"width\":4},{\"name\":\"name\",\"width\":5}]"}Example output
id,name 0001,Ada 0002,张三
When something does not work
Check the failing record length and widths. For CSV export, match header order and shorten overflowing fields or resolve embedded newlines. Remove the selected file before using pasted source.
Frequently asked questions
Does width mean UTF-8 bytes?
No. 张 and 😀 each count as one code point here, though their UTF-8 byte counts differ. Byte-based formats need a different specification.
Can it guess widths or trim padding?
No. Names and widths are explicit, and fixed-width padding remains part of the extracted value.
Why does reverse conversion reject a line break?
A multiline CSV value cannot fit one fixed-width physical record without changing its meaning.