Work with Zero-Padded Fields

Handle zero-padded numeric fields in fixed-width files. Learn when to use zero vs. space padding and how trimming affects leading zeros.

Column Definitions

Detailed Explanation

Zero-Padded Fields

Zero padding fills unused character positions with the digit 0 instead of spaces. It is standard practice in financial, government, and mainframe file formats where fixed-width fields must be fully populated with valid characters.

When Zero Padding Is Used

  • Account numbers: 0001234567 (10-digit field)
  • Transaction amounts: 0000012345 representing $123.45 (implied decimal)
  • Sequence numbers: 000001, 000002, ...
  • Date fields: 20240115 for January 15, 2024

Example: NACHA-Style Record

622123456789    0001234567000012345612345ALICE SMITH
622987654321    0009876543000098765412346JANE DOE

Column Layout

Field Width Pad Alignment
TransactionCode 3 Zero Left
RoutingNumber 9 Zero Right
Filler 4 Space Left
AccountNumber 10 Zero Right
Amount 10 Zero Right
TraceNumber 5 Zero Right
Name 22 Space Left

Trimming Considerations

When converting zero-padded fixed-width to CSV:

  • With trim enabled: 0001234567 becomes 1234567 (leading zeros removed)
  • With trim disabled: 0001234567 is preserved as-is

For financial data where leading zeros are significant (routing numbers, account numbers), consider disabling trim or post-processing the CSV output to preserve them.

Use Case

Processing NACHA/ACH payment files, government reporting files, or any mainframe-originated data that uses zero-fill padding for numeric identifiers and amounts.

Try It — Fixed Width ↔ CSV Converter

Open full tool