Skip to main content
ABA routing numbers are 9-digit codes used to identify financial institutions in the United States. They use the ABA 3-7-1 checksum algorithm for validation.

ABA 3-7-1 Checksum Algorithm

The routing number is valid if the weighted sum is divisible by 10 (modulo 10 = 0).

Validation Steps

Step 1: Multiply each digit by its weight Each digit position has a specific weight: 3, 7, 1, 3, 7, 1, 3, 7, 1 Example: 021000021
(0 × 3) + (2 × 7) + (1 × 1) + (0 × 3) + (0 × 7) + (0 × 1) + (0 × 3) + (2 × 7) + (1 × 1)
= 0 + 14 + 1 + 0 + 0 + 0 + 0 + 14 + 1
= 30
Step 2: Calculate modulo 10
30 mod 10 = 0
Step 3: Validate
  • If remainder = 0: Routing number is valid ✓
  • If remainder ≠ 0: Routing number is invalid ✗

Implementation in Go

package main

import "fmt"

func ValidateABARoutingNumber(aba string) bool {
	// Must be exactly 9 digits
	if len(aba) != 9 {
		return false
	}

	// 3-7-1 checksum algorithm:
	// Multiply positions 1,4,7 by 3; positions 2,5,8 by 7; positions 3,6,9 by 1
	// Sum all results — modulo 10 must equal 0
	d := func(i int) int { return int(aba[i] - '0') }

	sum := 3*(d(0)+d(3)+d(6)) +
		7*(d(1)+d(4)+d(7)) +
		1*(d(2)+d(5)+d(8))

	return sum%10 == 0
}

func main() {
	testCases := []struct {
		routingNumber string
		valid         bool
	}{
		{"021000021", true},  // Chase Bank
		{"111000025", true},  // Bank of America
		{"123456789", false}, // Invalid checksum
	}

	for _, tc := range testCases {
		result := ValidateABARoutingNumber(tc.routingNumber)
		status := "✓"
		if !result {
			status = "✗"
		}
		fmt.Printf("%s %s (expected: %v)\n", status, tc.routingNumber, tc.valid)
	}
}