Validating Bank Routing Numbers In JavaScript


Example code at

I have a test script at that I recently updated. I am having a hard time finding good documentation on it but ABA routing numbers that start with the number 5 are not valid. Routing numbers that start with 5 are internal bank routing numbers and are not valid for ACH transfers. Customers will often not realize that the routing number on their checks and the routing numbers on their bank deposit slips are different.

Here are the checks that I am doing in my JavaScript example:

  • routing number is a number
  • is 9 numbers in length
  • does not start with the number 5
  • checksum of routing number validates

For more information on the checksum for ABA routing numbers, check out wikipedia.

References for routing numbers starting with 5 being internal routing numbers:!topic/checkout-merchant/9XeAX4LAlqY