File structure
An ACH file (also called a NACHA file) is a plain ASCII text file made of fixed-width records. Every record is exactly 94 characters, and the first character is the record type code. Records always appear in this order:
- 1File Headeronce, first line
- 5Batch Headerstarts each batch
- 6Entry Detailone per payment
- 7Addendaoptional, after its entry
- 8Batch Controlcloses each batch
- 9File Controlonce
- 9…Filler (all 9s)to a multiple of 10 lines
Alphanumeric fields are left-justified and padded with spaces; numeric fields are right-justified and padded with zeros. Amounts have no decimal point: 0000125000 is $1,250.00. Dates are YYMMDD. Most banks expect uppercase letters.
File Header Record (type 1)
The first line of the file. It says who is sending the file and which bank it's going to.
| Position | Field | Length | Type | What goes here |
|---|---|---|---|---|
| 1 | Record Type Code | 1 | Numeric | Always 1 |
| 2–3 | Priority Code | 2 | Numeric | Always 01 |
| 4–13 | Immediate Destination | 10 | Alphanumeric | Your bank's routing number, preceded by a space |
| 14–23 | Immediate Origin | 10 | Alphanumeric | Your company ID or routing number, as your bank assigns it |
| 24–29 | File Creation Date | 6 | Date (YYMMDD) | YYMMDD |
| 30–33 | File Creation Time | 4 | Time (HHMM) | HHMM, 24-hour |
| 34 | File ID Modifier | 1 | Alphanumeric | A-Z or 0-9; change it for each file sent the same day |
| 35–37 | Record Size | 3 | Numeric | Always 094 |
| 38–39 | Blocking Factor | 2 | Numeric | Always 10 |
| 40 | Format Code | 1 | Numeric | Always 1 |
| 41–63 | Immediate Destination Name | 23 | Alphanumeric | Your bank's name |
| 64–86 | Immediate Origin Name | 23 | Alphanumeric | Your company name |
| 87–94 | Reference Code | 8 | Alphanumeric | Optional, for your own use |
Batch Header Record (type 5)
Starts a batch of entries that share a company, a payment type (SEC code), a description and an effective date. A file can hold many batches.
| Position | Field | Length | Type | What goes here |
|---|---|---|---|---|
| 1 | Record Type Code | 1 | Numeric | Always 5 |
| 2–4 | Service Class Code | 3 | Numeric | 200 mixed, 220 credits only, 225 debits only |
| 5–20 | Company Name | 16 | Alphanumeric | Name the receiver will recognize |
| 21–40 | Company Discretionary Data | 20 | Alphanumeric | Optional |
| 41–50 | Company Identification | 10 | Alphanumeric | Usually 1 + your EIN, or as your bank assigns |
| 51–53 | Standard Entry Class Code | 3 | Alphanumeric | PPD, CCD, WEB, TEL, CTX… |
| 54–63 | Company Entry Description | 10 | Alphanumeric | Shown to the receiver, e.g. PAYROLL |
| 64–69 | Company Descriptive Date | 6 | Alphanumeric | Optional, e.g. MAR 26 |
| 70–75 | Effective Entry Date | 6 | Date (YYMMDD) | YYMMDD, the date you want it to settle |
| 76–78 | Settlement Date | 3 | Blank | Julian date; left blank, the ACH Operator fills it |
| 79 | Originator Status Code | 1 | Alphanumeric | Usually 1 |
| 80–87 | Originating DFI Identification | 8 | Numeric (routing) | First 8 digits of your bank's routing number |
| 88–94 | Batch Number | 7 | Numeric | Numbered 1, 2, 3… in the file |
Service class codes: 200 mixed debits and credits, 220 credits only, 225 debits only.
Entry Detail Record (type 6)
One payment: who receives it, their bank and account, the amount and a unique trace number. This is the PPD, WEB and TEL layout; CCD uses the same positions but calls positions 40–54 the Identification Number and 55–76 the Receiving Company Name.
| Position | Field | Length | Type | What goes here |
|---|---|---|---|---|
| 1 | Record Type Code | 1 | Numeric | Always 6 |
| 2–3 | Transaction Code | 2 | Numeric | e.g. 22 checking credit, 27 checking debit |
| 4–11 | Receiving DFI Identification | 8 | Numeric (routing) | First 8 digits of the receiver's routing number |
| 12 | Check Digit | 1 | Numeric | 9th digit of the routing number |
| 13–29 | DFI Account Number | 17 | Alphanumeric | Receiver's account number, left-justified |
| 30–39 | Amount | 10 | Amount (cents) | In cents, no decimal point |
| 40–54 | Individual Identification Number | 15 | Alphanumeric | Optional ID, e.g. employee number |
| 55–76 | Individual Name | 22 | Alphanumeric | Receiver's name |
| 77–78 | Discretionary Data | 2 | Alphanumeric | Optional; payment type code for WEB/TEL |
| 79 | Addenda Record Indicator | 1 | Numeric | 1 if an addenda record follows, else 0 |
| 80–94 | Trace Number | 15 | Numeric | ODFI routing (8) + sequence number (7) |
CTX entry detail
Corporate trade exchange entries carry a count of addenda records and a shorter company name.
| Position | Field | Length | Type | What goes here |
|---|---|---|---|---|
| 1 | Record Type Code | 1 | Numeric | Always 6 |
| 2–3 | Transaction Code | 2 | Numeric | |
| 4–11 | Receiving DFI Identification | 8 | Numeric (routing) | |
| 12 | Check Digit | 1 | Numeric | |
| 13–29 | DFI Account Number | 17 | Alphanumeric | |
| 30–39 | Total Amount | 10 | Amount (cents) | In cents |
| 40–54 | Identification Number | 15 | Alphanumeric | |
| 55–58 | Number of Addenda Records | 4 | Numeric | |
| 59–74 | Receiving Company Name | 16 | Alphanumeric | |
| 75–76 | Reserved | 2 | Blank | |
| 77–78 | Discretionary Data | 2 | Alphanumeric | |
| 79 | Addenda Record Indicator | 1 | Numeric | |
| 80–94 | Trace Number | 15 | Numeric |
Addenda Record (type 7)
Extra information attached to the entry directly above it. PPD, CCD and WEB entries allow one addenda (type code 05) with 80 characters of payment information, such as an invoice number. The entry's Addenda Record Indicator must be 1.
| Position | Field | Length | Type | What goes here |
|---|---|---|---|---|
| 1 | Record Type Code | 1 | Numeric | Always 7 |
| 2–3 | Addenda Type Code | 2 | Numeric | 05 for PPD/CCD/WEB remittance info |
| 4–83 | Payment Related Information | 80 | Alphanumeric | Free-form remittance details |
| 84–87 | Addenda Sequence Number | 4 | Numeric | 1 for the first addenda of an entry |
| 88–94 | Entry Detail Sequence Number | 7 | Numeric | Last 7 digits of the entry's trace number |
Return addenda (type 99)
When a payment is returned, the bank sends back an entry with this addenda. The return reason code says why.
| Position | Field | Length | Type | What goes here |
|---|---|---|---|---|
| 1 | Record Type Code | 1 | Numeric | Always 7 |
| 2–3 | Addenda Type Code | 2 | Numeric | 99 = return |
| 4–6 | Return Reason Code | 3 | Alphanumeric | e.g. R01 insufficient funds |
| 7–21 | Original Entry Trace Number | 15 | Numeric | Trace number of the entry you sent |
| 22–27 | Date of Death | 6 | Alphanumeric | Only for R14/R15 |
| 28–35 | Original Receiving DFI Identification | 8 | Alphanumeric | |
| 36–79 | Addenda Information | 44 | Alphanumeric | |
| 80–94 | Trace Number | 15 | Numeric | Same as the return entry's trace number |
Notification of change addenda (type 98)
A notification of change (NOC) tells you to correct details, like an account number, before your next payment.
| Position | Field | Length | Type | What goes here |
|---|---|---|---|---|
| 1 | Record Type Code | 1 | Numeric | Always 7 |
| 2–3 | Addenda Type Code | 2 | Numeric | 98 = notification of change |
| 4–6 | Change Code | 3 | Alphanumeric | e.g. C01 incorrect account number |
| 7–21 | Original Entry Trace Number | 15 | Numeric | Trace number of the entry you sent |
| 22–27 | Reserved | 6 | Blank | |
| 28–35 | Original Receiving DFI Identification | 8 | Alphanumeric | |
| 36–64 | Corrected Data | 29 | Alphanumeric | What to change it to |
| 65–79 | Reserved | 15 | Blank | |
| 80–94 | Trace Number | 15 | Numeric | Same as the NOC entry's trace number |
Batch Control Record (type 8)
Closes the batch and repeats its totals so the bank can confirm nothing was added, lost or changed.
| Position | Field | Length | Type | What goes here |
|---|---|---|---|---|
| 1 | Record Type Code | 1 | Numeric | Always 8 |
| 2–4 | Service Class Code | 3 | Numeric | Same as the batch header |
| 5–10 | Entry/Addenda Count | 6 | Numeric | Entry and addenda records in the batch |
| 11–20 | Entry Hash | 10 | Numeric | Sum of receiving DFI IDs, last 10 digits |
| 21–32 | Total Debit Entry Dollar Amount | 12 | Amount (cents) | In cents |
| 33–44 | Total Credit Entry Dollar Amount | 12 | Amount (cents) | In cents |
| 45–54 | Company Identification | 10 | Alphanumeric | Same as the batch header |
| 55–73 | Message Authentication Code | 19 | Blank | Usually blank |
| 74–79 | Reserved | 6 | Blank | Blank |
| 80–87 | Originating DFI Identification | 8 | Numeric (routing) | Same as the batch header |
| 88–94 | Batch Number | 7 | Numeric | Same as the batch header |
File Control Record (type 9)
The last real record. Its totals cover every batch in the file.
| Position | Field | Length | Type | What goes here |
|---|---|---|---|---|
| 1 | Record Type Code | 1 | Numeric | Always 9 |
| 2–7 | Batch Count | 6 | Numeric | Number of batches |
| 8–13 | Block Count | 6 | Numeric | Records ÷ 10, rounded up |
| 14–21 | Entry/Addenda Count | 8 | Numeric | All entry and addenda records |
| 22–31 | Entry Hash | 10 | Numeric | Sum of batch entry hashes, last 10 digits |
| 32–43 | Total Debit Entry Dollar Amount in File | 12 | Amount (cents) | In cents |
| 44–55 | Total Credit Entry Dollar Amount in File | 12 | Amount (cents) | In cents |
| 56–94 | Reserved | 39 | Blank | Blank |
Transaction codes
The two-digit code in positions 2–3 of each entry says which kind of account it hits and whether money goes in (credit) or out (debit). General ledger (41–49) and loan (51–56) codes follow the same pattern.
| Code | Account | Direction | Meaning |
|---|---|---|---|
| 21 | Checking | Credit | Return or NOC (credit) |
| 22 | Checking | Credit | Credit (deposit) |
| 23 | Checking | Credit | Prenote, credit |
| 24 | Checking | Credit | Zero-dollar credit with remittance |
| 26 | Checking | Debit | Return or NOC (debit) |
| 27 | Checking | Debit | Debit (withdrawal) |
| 28 | Checking | Debit | Prenote, debit |
| 29 | Checking | Debit | Zero-dollar debit with remittance |
| 31 | Savings | Credit | Return or NOC (credit) |
| 32 | Savings | Credit | Credit (deposit) |
| 33 | Savings | Credit | Prenote, credit |
| 34 | Savings | Credit | Zero-dollar credit with remittance |
| 36 | Savings | Debit | Return or NOC (debit) |
| 37 | Savings | Debit | Debit (withdrawal) |
| 38 | Savings | Debit | Prenote, debit |
| 39 | Savings | Debit | Zero-dollar debit with remittance |
Standard Entry Class (SEC) codes
The SEC code in the batch header says how the payment was authorized, which decides the rules that apply to it.
| Code | Used for |
|---|---|
| PPD | Prearranged payment and deposit (consumer) |
| CCD | Corporate credit or debit |
| CTX | Corporate trade exchange |
| WEB | Internet-initiated or mobile entry |
| TEL | Telephone-initiated entry |
| IAT | International ACH transaction |
| ARC | Accounts receivable entry |
| BOC | Back office conversion |
| POP | Point-of-purchase entry |
| RCK | Re-presented check entry |
Entry hash and routing check digit
Entry hash
Add up the 8-digit Receiving DFI Identification of every entry in the batch (positions 4–11, the routing number without its last digit). Keep the rightmost 10 digits. The file control's hash is the sum of every batch hash, again keeping 10 digits.
Example: entries to routing numbers 011000015 and 122000247 give 01100001 + 12200024 = 0013300025.
Routing number check digit
Multiply the first 8 digits by 3, 7, 1, 3, 7, 1, 3, 7 and add the results. The check digit is the amount needed to reach the next multiple of 10. For 02100002: 0·3 + 2·7 + 1·1 + 0·3 + 0·7 + 0·1 + 0·3 + 2·7 = 29, so the check digit is 1 and the routing number is 021000021.
Example ACH file
A one-batch payroll file paying two employees, one with an addenda note. Open the viewer and paste it in to see each field decoded.
Return and change codes
Common return reason codes
| Code | Reason |
|---|---|
| R01 | Insufficient funds |
| R02 | Account closed |
| R03 | No account / unable to locate account |
| R04 | Invalid account number |
| R05 | Unauthorized debit to consumer account using corporate SEC code |
| R06 | Returned per ODFI request |
| R07 | Authorization revoked by customer |
| R08 | Payment stopped |
| R09 | Uncollected funds |
| R10 | Customer advises not authorized |
| R11 | Customer advises entry not in accordance with the terms of the authorization |
| R12 | Branch sold to another DFI |
| R13 | Invalid ACH routing number |
| R14 | Representative payee deceased |
| R15 | Beneficiary or account holder deceased |
| R16 | Account frozen |
| R17 | File record edit criteria |
| R20 | Non-transaction account |
| R21 | Invalid company identification |
| R22 | Invalid individual ID number |
| R23 | Credit entry refused by receiver |
| R24 | Duplicate entry |
| R29 | Corporate customer advises not authorized |
| R31 | Permissible return entry (CCD and CTX only) |
| R33 | Return of XCK entry |
Notification of change codes
| Code | What changed |
|---|---|
| C01 | Incorrect account number |
| C02 | Incorrect routing number |
| C03 | Incorrect routing number and account number |
| C04 | Incorrect individual name / receiving company name |
| C05 | Incorrect transaction code |
| C06 | Incorrect account number and transaction code |
| C07 | Incorrect routing number, account number and transaction code |
| C08 | Incorrect receiving DFI identification (IAT only) |
| C09 | Incorrect individual identification number |
| C13 | Addenda format error |
| C14 | Incorrect SEC code for outbound international payment |
Frequently asked questions
How long is each line in an ACH file?
Exactly 94 characters. Text fields are left-justified and padded with spaces; numeric fields are right-justified and padded with zeros. A line that is shorter or longer is the most common reason a bank rejects a file.
What file extension does an ACH file use?
It doesn't matter to the format: .ach, .txt and .dat are all common. The file is plain ASCII text with one 94-character record per line. Ask your bank which extension its upload portal expects.
What is the entry hash?
The sum of the 8-digit Receiving DFI Identification (the first 8 digits of each routing number) for every entry in the batch. If the sum has more than 10 digits, keep only the rightmost 10. The file control's entry hash is the sum of the batch hashes, again keeping the last 10 digits.
Why does my ACH file need lines of all 9s at the end?
Records are grouped in blocks of 10 (the blocking factor in the file header). If the file's record count isn't a multiple of 10, it's padded with filler records of 94 nines. The block count in the file control is the number of blocks including the filler.
What is the difference between Immediate Destination and Immediate Origin?
Immediate Destination is the bank or ACH operator receiving the file, written as a space followed by its 9-digit routing number. Immediate Origin identifies you, the sender; banks usually assign it, and it is often 1 followed by your 9-digit EIN.
What is a prenote?
A zero-dollar test entry (transaction code 23, 28, 33 or 38) sent before live payments to confirm the routing and account number are valid. If no return or notification of change comes back, live entries can follow.
This guide summarizes the standard record formats. The Nacha Operating Rules are the authority, and your bank may have extra requirements; check its ACH file specifications.