Skip to main content

Fixed Width Text File Definition:

A fixed width text file is a file that has a specific format which allows for the saving of textual information/data in an organized fashion. A fixed width text file does not use delimiters like commas or tabs to divide up fields. Fields are designated to start at a specific column which is identical for the entire file.


Fixed width text files are special cases of text files where the format is specified by column widths, pad character and left/right alignment.  Column widths are measured in units of characters. For example, if you have data in a text file where the first column always has exactly 10 characters, and the second column has exactly 5, the third has exactly 12 (and so on), this would be categorized as a fixed width text file.


If a text file follows the rules below it is a fixed width text file:

  • Each row (paragraph) contains one complete record of information.
  • Each row contains one or many pieces of data (also referred to as columns or fields).
  • Each data column has a defined width specified as a number of characters that is always the same for all rows.
  • The data within each column is padded with spaces (or any character you specify) if it does not completely use all the characters allotted to it (empty space).
  • Each piece of data can be left or right aligned, meaning the pad characters can occur on either side.
  • Each column must consistently use the same number of characters, same pad character and same alignment (left/right).

Below a typical fixed width text file is shown. It is specified by the following:

  • First column is 20 characters. It is left aligned. It is padded with spaces. It contains the NAME data within it.
  • Second column is 10 characters. It is left aligned. It is padded with spaces. It contains the STATE data within it.
  • Third column is 12 characters. It is left aligned. It is padded with spaces. It contains the TELEPHONE data within it.

So in total there are 42 characters per row:


123456789-123456789-123456789-123456789-12
NAME                STATE    TELEPHONE  
John Smith          WA       418-Y11-4111
Mary Hartford       CA       319-Z19-4341
Evan Nolan          IL       219-532-c301
			

If instead all three columns are right aligned it would look like this:


123456789-123456789-123456789-123456789-12
                Name     STATE   TELEPHONE
          John Smith        WA418-Y11-4111
       Mary Hartford        CA319-Z19-4341
          Evan Nolan        IL219-532-5301
			

Finally if in our original example we changed the alignment to right and the padding character were changed from space to the exclamation mark ! the fixed width text file would look like:


123456789-123456789-123456789-123456789-12
!!!!!!!!!!!!!!!!Name!!!!!STATE!!!TELEPHONE
!!!!!!!!!!John Smith!!!!!!!!WA418-Y11-4111
!!!!!!!Mary Hartford!!!!!!!!CA319-Z19-4341
!!!!!!!!!!Evan Nolan!!!!!!!!IL219-532-5301
		
Convert Fixed Width Files Now

Free Trial - No Email Address Required

Tools For Conversion of Fixed Width Text Files


Convert Fixed Width Files today