← Hashito System Home 日本語 Tools Blog
Input & Options
Result

About fixed-width files

Why fields are cut by bytes, not characters

Fixed-width formats, such as those used by mainframes and banks, define each field as a number of bytes. A full-width character takes 2 bytes in Shift_JIS but 3 in UTF-8, so cutting by character count shifts the columns for the same data. This tool counts bytes using the rules of the charset you select.

How byte counts differ between Shift_JIS and UTF-8

In Shift_JIS, ASCII and half-width katakana take 1 byte and kana, kanji and full-width symbols take 2. In UTF-8, ASCII takes 1 byte while kana, kanji and half-width katakana all take 3. The same four-kanji name is 8 bytes in Shift_JIS and 12 in UTF-8. Choose Shift_JIS if the source file was produced that way.

The per-line byte length check

The most common failure when importing a fixed-width file is a line whose length does not match the definition. This tool compares the actual byte length of each line against the sum of the widths you entered and lists only the lines that differ, with line numbers. Splitting continues regardless, so you can see where the drift starts.

Characters are never split in half

If a width boundary falls in the middle of a multi-byte character, that character moves to the next field instead of being cut. This avoids emitting broken bytes, and the line is reported in the byte length check.

Range of characters covered

Byte counting uses the common Shift_JIS rule: 1 byte for ASCII and half-width katakana, 2 bytes for everything else. For data containing characters that Shift_JIS cannot represent, the count may not match the real file.

Frequently Asked Questions

Can it pack CSV back into fixed-width?

Yes. Choose "CSV to fixed-width" and each field is padded to its width and concatenated. You can pad left-aligned with spaces, or right-aligned with zeros as amount fields usually require. Fields longer than their width are truncated and the line is flagged.

Is the data I paste sent anywhere?

No. Splitting, conversion and download all happen inside your browser. Nothing you enter is sent to a server.

What if a field contains a comma?

When writing CSV, any field containing a comma, double quote or newline is wrapped in double quotes and inner quotes are doubled. If you choose tab separated output, tabs inside a field are replaced with spaces.

Can I strip leading zeros or trailing spaces?

Yes. Padding handling offers four choices: trim trailing spaces, trim both ends, strip leading zeros, or keep the value as is. Zero-padded fields such as slip numbers can use the third option.