固定宽度解析

固定宽度文本转 CSV 转换器

将固定宽度或固定长度文本(列通过空格对齐而非分隔符)转换为干净的 CSV。自动检测列边界或设置精确宽度,预览分割,并导出。

免费无需注册在浏览器中运行兼容 Excel
开始转换
固定宽度文本转 CSV 转换器
粘贴或上传文本以进行转换。
输入 — 粘贴或上传
Drag a file here, or browse (.txt, .csv, .tsv, .json)
输出
输入类型
输入分隔符
列宽
输出为
自定义分隔符
纯文本样式
引号处理
换行符

此处将实时预览数据表格。

Leave 列宽 blank to auto-detect, or type widths like 10 8 12 to set them exactly.

广告
功能一览

Convert fixed-width text to CSV

Fixed-width files line up data by character position instead of a delimiter — common in banking, mainframe and legacy report exports. To convert fixed width text to CSV, the tool slices each line at the right positions and writes proper comma-separated values.

Paste or upload the text. Leave 列宽 empty and the converter detects boundaries by finding the positions that are blank in every row; or enter the widths yourself (for example 10 8 12) for full control. The live preview shows the resulting columns immediately.

If your data is actually separated by a character, use delimited text to CSV. For the reverse, see CSV to fixed width.

分步指南

How to use it

粘贴或上传

Add your text or drop a file — it is read locally in your browser, never uploaded.

Preview & adjust

Check the live table and the row / column counts, then tweak the delimiter or options if a column looks off.

Copy or download

Grab the result with Copy or Download. You can reopen recent conversions from this device too.

示例

Input and output example

Space-aligned fixed-width columns parsed into CSV (widths auto-detected).

Input
name      city
Ada       NY
Lin       LA
输出
name,city
Ada,NY
Lin,LA
Details

Defining columns precisely

自动检测可处理大多数文件;显式指定宽度可处理复杂情况。

Auto-detecting column boundaries

With 列宽 blank, the parser scans your rows and marks every character column that is a space in all of them as a gap, then treats the runs between gaps as fields. This works well when columns are cleanly separated by at least one space.

Setting exact widths

When values touch or a column can be blank, auto-detection may guess wrong. Enter the widths directly — 10 8 12 means the first field is 10 characters, the next 8, then 12, with anything left over forming a final column. Use a 0 to capture the remainder of the line.

Trimming and empty fields

Each sliced field is trimmed of surrounding spaces, so padded values come out clean. Blank positions become empty CSV cells rather than disappearing, keeping every row the same width.

Verifying with the preview

The table preview and the column-count indicator make it obvious when a width is off — misaligned data shows up immediately, so you can adjust the widths before exporting.

Good to know

Tips and edge cases

  • Count characters in a header row to work out exact widths quickly.
  • A trailing 0 width captures everything remaining on the line.
  • If fields run together with no gap, explicit widths are the only reliable option.
Good to know

Why fixed-width files still exist

Fixed-width feeds persist in finance, government and older enterprise systems because they are unambiguous: every field has a known position. Converting them to CSV makes the same data usable in modern tools without rewriting the source. When a specification lists exact field widths, enter them directly for a perfect split; otherwise auto-detection is a fast first pass you can verify in the preview.

常见问题

Fixed Width Text to CSV Converter — FAQ

How do I define column widths?

Type them in the Column widths box, separated by spaces, e.g. 10 8 12. Leave it blank to auto-detect.

How does auto-detection find fields?

It marks character positions that are blank in every row as gaps and treats the text between gaps as columns.

What if columns have no space between them?

Use explicit widths — auto-detection needs at least one space between columns.

Are surrounding spaces removed?

Yes, each field is trimmed so padded values come out clean.