🏦 For transfers, invoices and payments in Morocco
🏦 Moroccan RIB checker: key, bank and IBAN conversion
Paste a 24-digit RIB or a Moroccan IBAN (MA…): the tool checks the key, spots the mistyped digit, shows the bank and how the number breaks down, then gives you the IBAN ready to copy.
🔒 Everything happens in your browser: the RIB is neither sent nor saved, not even on this device.
Spaces, dashes and dots are ignored. An IBAN (MA…) is recognised automatically.
RIB breakdown
How to read a Moroccan RIB
A Moroccan RIB (bank account number) always has 24 digits, in four blocks. Here is the RIB published by Bank Al-Maghrib for the special earthquake fund:
- Bank code (3 digits)
- Branch locality code (3 digits)
- Account number (16 digits)
- RIB key (2 digits)
The key is there to catch copying mistakes: the 24 digits, read as one number, must be a multiple of 97. A single mistyped digit, or two neighbouring digits swapped, is therefore always detected.
No official text publishes this formula: it has been checked against real RIBs published by Bank Al-Maghrib, Attijariwafa bank and Bank of Africa.
Why a Moroccan IBAN always starts with MA64
A Moroccan IBAN is made of "MA", two check digits and the 24 digits of the RIB: 28 characters in all. The two check digits are calculated with the ISO 13616 standard (remainder of a division by 97).
A correct RIB is a multiple of 97, so in that calculation only the "MA00" part is left, which becomes 221000 in digits and leaves a remainder of 34. The key is then 98 − 34 = 64, whatever the account.
In practice: a Moroccan IBAN that does not start with MA64 necessarily contains an error, and turning a correct RIB into an IBAN simply means adding MA64 in front of it.
RIB, IBAN, SWIFT/BIC: what is the difference?
- RIB: the 24 digits that identify an account in Morocco. It is enough for a transfer between Moroccan banks.
- IBAN: the same RIB preceded by MA64, in the international format (28 characters). It is asked for to receive a transfer from abroad.
- SWIFT/BIC: 8 or 11 letters and digits that identify the bank, not the account (for example BKAMMAMR for Bank Al-Maghrib). An international transfer needs both the IBAN and the BIC.
A correct key does not mean a safe account
- The key only proves that the number is well formed. It tells you neither whether the account exists nor who owns it: a scammer can give you a perfectly valid RIB.
- Fake RIB fraud: an email or a WhatsApp message says that "the bank details have changed". Before paying, always check through another channel, for example by calling a number you already knew, never the one given in the message.
- Check the account holder's name: it must match the person or company you are paying. If in doubt, ask your bank for advice before the transfer.
- For a first large payment, a small test transfer confirmed by the recipient limits the risk.
A message looks suspicious? Check a suspicious message
Limits
The tool checks the form of the RIB, not the account: it does not connect to any bank. Bank names come from public code lists (no official list is published) and may have changed, as when Société Générale Maroc became Saham Bank. There is no public list of locality codes either: the city is shown for only three codes seen on real RIBs.
Frequently asked questions
What does "invalid RIB key" mean?
The 24 digits do not form a multiple of 97: at least one digit was miscopied, left out or swapped. Copy the RIB again from the original document (statement, RIB certificate, banking app) rather than guessing the correction.
Does a valid RIB prove that the account exists?
No. The key only checks that the number is consistent. Only the bank can confirm that the account exists and who owns it.
How do I convert a Moroccan RIB into an IBAN?
Add MA64 in front of the 24 digits of a correct RIB. The tool does it for you and shows the IBAN in groups of 4, as on bank documents.
Where can I find my RIB?
In your bank's app or online banking (RIB or bank details section), on a RIB certificate requested at your branch, or on your account statement.
What do the first three digits of the RIB mean?
They are the bank code: 007 for Attijariwafa bank, 011 for Bank of Africa, 230 for CIH Bank, 001 for Bank Al-Maghrib… Each regional Banque Populaire has its own code. The next three digits are the locality of the branch.
Do I need a SWIFT code to receive a transfer from abroad?
Usually yes: give your IBAN (MA64…) and your bank's SWIFT/BIC code, which appears on your RIB certificate. Morocco is not in SWIFT's official IBAN registry: some foreign banks ask for the IBAN, others only for the account number, so give both if needed.
Sources: RIBs published by Bank Al-Maghrib (special earthquake fund, 2023), RIB structure described by the US Social Security Administration (POMS GN 02402.297), Moroccan IBAN format from iban.com, ISO 13616 standard. Updated: October 2026. bkam.ma · ssa.gov · iban.com
Handy tools, before everyone else
Join the OUFRID club: early access, free Premium and your name in the app.
Join the club