NACHA file format
A NACHA file is the text file your bank accepts for a batch of ACH payments. It is fixed-width: every line is exactly 94 printable ASCII characters, each field lives at a set position, and the file is padded with lines of 9s to a multiple of ten lines.
Below: an annotated example you can click through, the record order, and the position of every field in all six record types. For complete downloadable files, see the NACHA file examples for payroll, vendor payments and prenotes.
File Header
Identifies the destination and origin, file creation time, blocking factor, and format code.
Hover a highlighted field to inspect it.
Entry hash
Add the first eight digits of every receiving DFI identification from entry detail records. Keep only the lowest ten digits of that sum. Batch control (positions 11–20) and file control (positions 22–31) must match.
In the sample file, the batch control entry hash is 0000198100 and the credit total is 0000000013023 cents ($130.23).
Block padding
ACH files are blocked in groups of ten 94-character records. If the logical records do not fill the last block, the file ends with one or more lines containing only the digit 9.
This sample contains ten physical records: six logical records plus four all-9 padding lines.
Record order in a credits-only file
- File Header (type 1)
- Batch Header (type 5)
- One or more Entry Detail records (type 6)
- Optional Addenda records (type 7) after entries that need them
- Batch Control (type 8)
- File Control (type 9)
- Blocking padding lines containing only the digit 9
NACHA file layout: every field position
Positions are 1-based and inclusive. Numeric fields are right-aligned with leading zeros; text fields are left-aligned and padded with spaces.
Type 1: File Header
Identifies the destination and origin, file creation time, blocking factor, and format code.
| Positions | Field | Contents |
|---|---|---|
| 1 | Record type code | Always 1 for the file header. |
| 2–3 | Priority code | Usually 01. |
| 4–13 | Immediate destination | Ten-character routing number of the receiving bank or ACH operator. |
| 14–23 | Immediate origin | Ten-character company or originator routing number. |
| 24–29 | File creation date | YYMMDD when the file was created. |
| 30–33 | File creation time | HHMM in 24-hour time. |
| 34 | File ID modifier | A–Z or 0–9. Distinguishes multiple files created the same day. |
| 35–37 | Record size | Always 094. |
| 38–39 | Blocking factor | Always 10 for ACH files. |
| 40 | Format code | Always 1. |
| 41–63 | Immediate destination name | Bank or operator name. |
| 64–86 | Immediate origin name | Company or originator name. |
| 87–94 | Reference code | Optional reference for internal use. |
Type 5: Batch Header
Describes the company, SEC code, entry description, effective date, and originating DFI.
| Positions | Field | Contents |
|---|---|---|
| 1 | Record type code | Always 5 for a batch header. |
| 2–4 | Service class code | 220 = credits only in this generator. |
| 5–20 | Company name | Name that appears on the receiver's statement. |
| 21–40 | Company discretionary data | Optional internal data. |
| 41–50 | Company identification | Tax ID or other company ID assigned by the ODFI. |
| 51–53 | Standard entry class code | CCD for vendors or PPD for payroll. |
| 54–63 | Company entry description | Short description such as PAYROLL or VENDOR PAY. |
| 64–69 | Company descriptive date | Optional date shown to the receiver. |
| 70–75 | Effective entry date | YYMMDD when entries should settle. |
| 76–78 | Settlement date | Filled by the ACH operator; usually blank in outgoing files. |
| 79 | Originator status code | 1 = live, 0 = test. |
| 80–87 | Originating DFI identification | First eight digits of the ODFI routing number. |
| 88–94 | Batch number | Sequential batch number within the file. |
Type 6: Entry Detail
One payment or prenote. Contains routing, account, amount, recipient name, and trace number.
| Positions | Field | Contents |
|---|---|---|
| 1 | Record type code | Always 6 for an entry detail. |
| 2–3 | Transaction code | 22/32 = credit, 23/33 = prenote, 27/37 = debit (not generated here). |
| 4–11 | Receiving DFI identification | First eight digits of the recipient routing number. |
| 12 | Check digit | Ninth digit of the routing number. |
| 13–29 | DFI account number | Recipient account number, left-justified. |
| 30–39 | Amount | Ten-digit amount in cents with leading zeros. |
| 40–54 | Individual identification number | Optional employee or vendor ID. |
| 55–76 | Individual name | Recipient name as it should appear on the statement. |
| 77–78 | Discretionary data | Optional two-character field. |
| 79 | Addenda record indicator | 0 = no addenda, 1 = addenda record follows. |
| 80–94 | Trace number | ODFI routing (8) plus a unique seven-digit sequence. |
Type 7: Addenda
Optional payment-related text linked to the preceding entry detail record.
| Positions | Field | Contents |
|---|---|---|
| 1 | Record type code | Always 7 for addenda. |
| 2–3 | Addenda type code | 05 = payment-related information. |
| 4–83 | Payment related information | Up to 80 characters of reference text. |
| 84–87 | Addenda sequence number | Usually 0001 for a single addenda. |
| 88–94 | Entry detail sequence number | Last seven digits of the related trace number. |
Type 8: Batch Control
Batch totals: entry/addenda count, entry hash, debit and credit amounts.
| Positions | Field | Contents |
|---|---|---|
| 1 | Record type code | Always 8 for batch control. |
| 2–4 | Service class code | Must match the batch header. |
| 5–10 | Entry/addenda count | Total type 6 and type 7 records in the batch. |
| 11–20 | Entry hash | Sum of receiving DFI IDs, lowest ten digits. |
| 21–32 | Total debit entry dollar amount | Zero for credits-only files. |
| 33–44 | Total credit entry dollar amount | Sum of entry amounts in cents. |
| 45–54 | Company identification | Must match the batch header. |
| 55–73 | Message authentication code | Optional; usually blank. |
| 74–79 | Reserved | Blank. |
| 80–87 | Originating DFI identification | Must match the batch header. |
| 88–94 | Batch number | Must match the batch header. |
Type 9: File Control
File-level totals, block count, and hash. Followed by all-9 padding records.
| Positions | Field | Contents |
|---|---|---|
| 1 | Record type code | Always 9 for file control. |
| 2–7 | Batch count | Number of batch headers in the file. |
| 8–13 | Block count | Total physical blocks of ten records. |
| 14–21 | Entry/addenda count | Total type 6 and type 7 records in the file. |
| 22–31 | Entry hash | Must match batch control entry hash. |
| 32–43 | Total debit entry dollar amount | Zero for credits-only files. |
| 44–55 | Total credit entry dollar amount | Must match batch credit total. |
| 56–94 | Reserved | Blank. |
Why banks reject NACHA files
- A line that is not exactly 94 characters, often from a trailing space trimmed by a text editor.
- Entry hash, entry count or credit total in the batch or file control that does not match the entries.
- The line count is not a multiple of ten because the 9-padding is missing.
- Wrong immediate destination, immediate origin or company ID. These come from your bank, not from the format.
- Lowercase letters or characters outside plain ASCII in names. See the ACH return codes for what comes back after a file is accepted.
The ACH file validator checks all of these in your browser. Transaction codes in positions 2–3 of each entry are explained in ACH transaction codes, and the SEC code in the batch header in CCD vs PPD.
What this guide does not cover
Banks can require different header values, naming, testing steps, and effective-date rules. This guide explains public NACHA layout concepts but does not claim independently verified compliance or guarantee bank acceptance.
Next steps
Validate an ACH file, open a NACHA file in Excel, download the import template, or create a file from Excel or CSV.
Questions
What is a NACHA file?
A NACHA file (also called an ACH file) is the plain text file a business uploads to its bank to send a batch of ACH payments, such as payroll direct deposits or vendor payments. The layout is set by Nacha, the organization that runs the ACH network rules, which is where the name comes from.
What file extension does a NACHA file use?
Usually .ach or .txt. The extension does not matter to most banks; the content does. It must be plain ASCII text with 94-character lines, uppercase letters and no tabs.
Why does every line have to be exactly 94 characters?
The format is fixed-width: each field is identified only by its position, so a missing or extra space shifts every field after it. Most bank rejections of hand-edited files come from a line that is 93 or 95 characters long.
What is the entry hash in a NACHA file?
The sum of the first eight digits of every receiving bank routing number in the batch, keeping only the last ten digits. It appears in the batch control and file control records so the bank can detect lost or altered entries.
Do I need to write a NACHA file by hand?
No. Most payroll and accounting systems export one, and if yours does not, you can build one from an Excel or CSV list of payments with a generator. Writing one by hand is only practical for testing.