固定宽度输出

CSV 转固定宽度文本转换器

将 CSV 转换为固定宽度文本,将每列填充到指定宽度,使数据在等宽字体视图中完美对齐。适用于主机数据馈送、报告和传统固定长度格式。

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

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

Output is fixed-width — each column is padded to its widest value automatically.

广告
功能一览

Convert CSV into fixed-width text

Fixed-width (fixed-length) text aligns every column by character position instead of using a separator — still required by many mainframe, banking and reporting systems. To convert CSV to fixed width text file, this tool measures each column and pads the values so they line up.

Paste or upload your CSV and the converter computes each column’s width from its longest value, then writes aligned rows. The result looks like a clean table in any monospaced editor and is ready for systems that parse by position.

Going the other way — reading fixed-width text into CSV — is handled by fixed width to CSV. For other separators, see CSV to delimited text.

分步指南

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

CSV padded into fixed-width columns that line up in a monospaced view.

Input
id,name,city
1,Ada,NY
20,Lin,LA
输出
id  name  city
1   Ada   NY
20  Lin   LA
Details

How columns are aligned

统一的宽度使文件既易于阅读,也便于机器解析。

Automatic column widths

The converter scans every row to find the longest value in each column, then pads all values in that column to match, adding a space of separation. The output aligns cleanly without you measuring anything.

Reading it back

Because the widths are consistent, systems that parse by position can read the file reliably. If you later need it as CSV again, the fixed width to CSV tool can auto-detect the same boundaries.

Monospaced viewing

View the result in a monospaced font (most code editors) to see the columns line up. Proportional fonts will not show the alignment correctly even though the file is valid.

Encoding

Output is UTF-8. Note that multi-byte characters occupy one character position here, which is the usual convention for text alignment.

Good to know

Fixed-width text, then and now

Fixed-width formats predate delimited files and still anchor a surprising amount of infrastructure in banking, government and insurance. Their appeal is determinism: because every field occupies a known range of character positions, a reader never has to guess where one column ends and the next begins, and there is no delimiter to collide with the data. Converting a CSV to fixed-width text lets modern, comma-based data flow into those systems unchanged. The key is consistency, which this tool guarantees by padding each column to the width of its longest value. When a downstream specification dictates exact widths, keep that in mind — you may need to pad the source so columns match the required layout. View the output in a monospaced font to confirm the alignment, and remember the fixed-width-to-CSV tool reverses the process whenever you need the data back as CSV.

常见问题

CSV to Fixed Width Text Converter — FAQ

How are column widths chosen?

Each column is padded to the width of its longest value, with a space of separation.

What is fixed-width text used for?

Mainframe feeds, banking files and legacy reports that parse data by character position.

Why doesn’t it line up in my viewer?

Use a monospaced font; proportional fonts will not show the alignment.

Can I convert it back to CSV?

Yes, use the fixed width to CSV tool.