Routing number (Canada)
A routing number is the term for bank codes in Canada. Routing numbers consist of eight numerical digits with a dash between the fifth and sixth digit for paper financial documents encoded with magnetic ink character recognition and nine numerical digits without dashes for electronic funds transfers. Routing numbers are regulated by Payments Canada, formerly known as the Canadian Payments Association, to allow easy identification of the branch location and financial institution associated with an account.

Format 
A routing number consists of a five digit transit number (also called branch number) identifying the branch where an account is held and a three digit financial institution number corresponding to the financial institution. The number is given as one of the following forms, where XXXXX is the transit number and YYY is the financial institution number:

  for MICR-encoded documents
  for electronic funds transfers

A leading zero is used when formatting a routing number for electronic payments.

Routing symbol
The symbol that delimits a routing number on MICR-encoded paper documents is the E-13B transit character (Unicode value U+2446): ⑆

Transit numbers 
Each branch in a financial institution is assigned a unique transit number for identification. The format of the transit number may vary by institution.

Most institutions use the transit number and branch number synonymously. TD and Bank of Montreal use four-digit branch numbers, reserving the final digit of the transit number for the geographical location of the branch.

While there is variation between institutions, most transit numbers encode geographic region into the last digit using a pattern like:

  for British Columbia and Yukon
  for western Quebec, including Montreal. Some institutions include Gatineau here, others group it with  Ottawa.
  for most of Ontario, including Toronto and Southern Ontario
  for Nova Scotia, Prince Edward Island. Some institutions list Newfoundland or Labrador here.
  for New Brunswick
  for eastern Quebec including Quebec City
  for Ottawa and its surrounding area.
  for Manitoba and north-western Ontario, including Thunder Bay.
  for Saskatchewan
  for Alberta, the Northwest Territories and Nunavut

In this pattern, the first branch of the first national bank (Banque de Montréal, 119, rue Saint Jacques, Montréal) would be branch 0001, institution 001, in western Québec yielding MICR code .

BMO and TD do not consider the fifth digit of the transit number to be part of the branch number and will not create five-digit codes for different branches which differ only in the final, fifth digit. If Montreal is  then the next site (First Canadian Place Toronto) is , with  remaining permanently unassigned. Likewise, if you are trying to figure out the routing number for a branch of either TD Bank or BMO, then you need to have a 0, followed by the 3-digit Institution Number, then the 4-digit branch number, followed by the single-digit number for the region in which the bank is located. For example, to get the routing number of a TD Bank branch situated in Scarborough, ON with the transit number 1795, you'll have to use 000417952  i.e. 0 [Start off] 004 [Institution Number] 1795 [Branch Transit number] 2 [because the branch is in Ontario].

RBC also uses four-digit branch numbers, but these include the last digit, with the transit numbers instead being padded with leading zeroes. While some older branches happen to adhere to the pattern above, it has been abandoned for many newer RBC branches, apparently to limit RBC's branch transit numbers to four digits.

Desjardins uses all five digits as significant with no region coding in the fifth digit.

Most small local credit unions use the institution number to indicate a "Credit Union Central" organisation for a specific province; the transit number indicates a specific branch of a specific member institution. As transit numbers are issued arbitrarily or sequentially, multiple branches of the same credit union typically do not get assigned a contiguous block of numbers. While the province may be embedded in the transit number, the info is superfluous; a small Ontario credit union will be  regardless of its location in-province.

Financial institution numbers 

A selection of institution numbers for major Canadian financial institutions is below.

Directories of routing numbers
Payments Canada maintains the Financial Institutions File (FIF), an electronic directory of routing numbers for all financial institutions in Canada. The FIF is updated weekly and is operated as a fee-based subscription service to member institutions of Payments Canada.

A companion free-of-charge directory, the Financial Institutions Branch Directory (FIBD), is also operated by Payments Canada for occasional referencing by the general public. The FIBD is only available in PDF format and cannot be imported into business applications.

See also
 International Bank Account Number
 ABA routing transit number, American bank code format
 Bank State Branch, Australian bank code format
 Bankleitzahl, Austrian and German bank code format
 New Zealand bank account prefix
 Sort code, British and Irish bank code formats

Notes

References

Bank codes
Banking in Canada
Banking terms