Bankgiro OCR Reference Number Generator and Checker (Sweden)

Check OCR numbers from invoices or generate them from customer and invoice numbers with the mod 10 check digit and, if your agreement uses it, the length digit.

Runs in your browser. Your files never leave your device. See how to check

…

How to do it

  1. 1
    Set your rules

    Tick the length digit if your agreement uses it and set the length limits.

  2. 2
    Check references

    Paste OCR numbers, one per line, to see which pass.

  3. 3
    Generate

    Use the sample button or add check digits to your own base numbers.

  4. 4
    Fix errors

    Use the expected check digit to correct wrong references.

  5. 5
    Export

    Download the results as CSV.

About this tool

Most Swedish invoices ask the payer to enter an OCR number with the payment. The OCR reference lets the payee's bank match the payment automatically to the right invoice. For Bankgiro receivables with OCR control, the reference must end with a check digit calculated with the modulo 10 (Luhn) method, and some agreements also require a length digit, the last digit of the total length, placed just before the check digit. Payments with a wrong reference are rejected by the payer's bank, which saves you from unmatched payments. This tool generates valid OCR numbers from your invoice or customer numbers and checks existing ones in bulk, with your agreement's length limits.

Who this is for

Small businesses and associations that send invoices with Bankgiro, developers building invoicing software, and accountants checking reference lists.

How the check digit works

Starting from the right of the number without the check digit, every other digit is doubled. When a doubled digit is 10 or more, its two digits are added. The sum of all digits is taken, and the check digit is what brings the sum up to the next multiple of 10. For 123456789 the check digit is 7, so the OCR number is 1234567897. This method catches every single wrong digit and almost all swaps of two neighbouring digits.

The length digit

With OCR control at the highest level, Bankgirot can also check the length. The length digit is the last digit of the total number of digits, including the length digit and the check digit, and it sits just before the check digit. For a base of 12345, the full number has 7 digits, so the length digit is 7 and the check digit is calculated over 123457. Tick the box if your Bankgiro agreement uses length control.

Length limits

OCR references can have from 2 to 25 digits. Your agreement may set a fixed length or a range; enter it so that the checker rejects numbers outside it. A fixed length is common because it makes the length digit unnecessary.

Building good references

A common pattern is customer number plus invoice number, for example 1002 and 3456 become 10023456 plus the check digit. Keep the length fixed if you can, avoid leading zeros that a payer might drop, and print the reference clearly on the invoice and in the payment slip.

Batch

Paste a list of base numbers to see their check digits, or paste references from a bank file to find the ones that are wrong. Export the results as CSV.

Plusgiro

Plusgiro uses the same modulo 10 method for its OCR references, so the checker works for those too, but check your agreement for length rules.

Worked example

The base 123456789 gets the check digit 7, giving 1234567897. With length control, the base 12345 becomes 1234577: length digit 7, then the check digit.

Limits

The tool follows the published method; your bank decides what it accepts. It is not affiliated with Bankgirot.

Worked example

The base number 123456789 gets the check digit 7, so the OCR reference is 1234567897.

Quick facts

Frequently asked questions

How is the OCR check digit calculated?

With the modulo 10 (Luhn) method: double every other digit from the right, add the digits and round up to the next ten.

What is the length digit?

The last digit of the total length, placed before the check digit, used only if your agreement has length control.

How long can an OCR number be?

From 2 to 25 digits, unless your agreement sets a fixed length or range.

Why was a payment rejected?

Usually because the OCR number was mistyped and the check digit no longer matches.

Does this work for Plusgiro?

Yes, Plusgiro OCR references use the same modulo 10 check.

Are my numbers uploaded?

No. The check runs on your device only.

Guides for this tool

Completely freeNo cost, no sign-up
Files stay privateEverything runs in your browser
Easy in your languageAvailable in many languages