By Tim


2012-10-30 08:41:57 8 Comments

Is there any existing library or script I can use to generate the BIC code from an IBAN bank account number (and other necessary information)?

I've searched the web, but found only IBAN generators.

Thanks in advance!

8 comments

@FlorianH 2019-04-15 11:05:01

Readily get the BIC for a given IBAN:

https://www.ibancalculator.com/iban_validieren.html

Just used it for an IBAN and it gave me the seemingly correct, valid BIC for it.

I do not know whether the page's conversion can readily be automated.

@Kiddo 2017-04-10 13:11:18

Found solution for all IBAN accounts (I think):

https://openiban.com/validate/IBAN_NUMBER?getBIC=true

If you make a CURL call for example to that URL, you will get the Account bank info for free. Replace IBAN_NUMBER with your IBAN account.

Example:

`https://openiban.com/validate/DE89370400440532013000?getBIC=true`

Result:

{
  "valid": true,
  "messages": [],
  "iban": "DE89370400440532013000",
  "bankData": {
    "bankCode": "37040044",
    "name": "Commerzbank",
    "zip": "50447",
    "city": "Köln",
    "bic": "COBADEFFXXX"
  },
  "checkResults": {}
}

Important Update

OpenIBAN has shut down it's API service due to the GDPR regulations posing unknown risks on the service provider. See the statement on openIBAN.com. There is also a link to a self-hosting guide included, see this github page.

@domsson 2017-04-10 13:31:12

Their website states the BIC lookup is currently available for the following countries: Belgium, Germany, Netherlands, Luxembourg and Switzerland

@Mixxiphoid 2017-08-14 12:41:30

A recent update added Austria and Liechtenstein support.

@Florian Müller 2017-11-02 14:04:11

Excellent answer, this webservice saved my day! Thanks @Kiddo!

@Peter 2018-05-31 13:23:02

OpenIBAN is no longer reachable.

@FlorianH 2019-04-15 10:55:16

openiban is throwing me an "IBAN is not valid" error for a correct IBAN number I'm directly reading from a bank card (Switzerland)

@Wilgert 2013-11-05 09:50:40

I created a Webservice that can convert both Dutch and Belgian IBAN to the corresponding BIC. More countries might be added in the future if that appears feasible.

Have a look at: http://iban2bic.nl

Usage of the api: http://iban2bic.nl/api/:iban

This website has been offline for a while. I have now open sourced the code here: https://bitbucket.org/wilgert/iban2bic

Disclaimer: the code is old and might contain bugs, stupid mistakes and/or security vulnerabilities. Furthermore the list of Dutch bank is far from complete because a large number of banks has been added since 2013.

@SamekaTV 2013-12-23 14:44:47

I can't access the 'usage of api' page. Could you just explain how you get the BIC for IBAN codes??

@Wilgert 2013-12-27 12:43:45

It's an anchor link, the content for API is on the same page. To answer your second question. For the Dutch banks I use a PHP script that looks up the BIC from the bank identifier part of the IBAN by using this array: gist.github.com/wilgert/7305244#file-dutch_banks-json. For Belgian banks I rely upon the webservice from this answer: stackoverflow.com/a/13137295/357601 For banks from other countries the service does not work yet.

@jww 2014-08-24 00:14:06

@Wilgert - you should provide the information in your Answer. Or change your Answer to a comment. As you can see from jitsCode's comments, link-only answers have problems. That's why Stack Overflow generally does not want them.

@Peter 2018-05-31 13:20:56

I recommend improving your answer by adding a code example here.

@andrewxbg 2016-11-16 11:34:10

There is no simple way to 'generate' BIC from an IBAN as BICs are independent number not present in the IBAN. ( Some countries have a part of the BIC in the IBAN ).

There is a number of services providing such data. www.swift.com is a corporate service. Not very cheap though.

A good solution for small/medium businesses could be: https://www.iban.com/validation-api-v2.html

They have somewhat more flexible pricing plans.

@Meint-Willem Gaasbeek 2014-01-21 15:09:39

 $json_url = 'http://iban2bic.nl/api/'.$iban_number_of_dutch_bank;
 $json = file_get_contents($json_url);
 $data = json_decode($json, TRUE);

 $bic  = $data['bic']; // holds the BIC number

@Tim 2012-10-30 10:43:17

Solution for Belgian IBAN bank account numbers:

There exists a webservice for Belgian iban numbers, it's very easy to get the bic from the iban bank account number.

$client = new SoapClient('http://www.ibanbic.be/IBANBIC.asmx?WSDL');
$bban = $client->getBelgianBBAN(array('Value' => $iban))->getBelgianBBANResult;
$bic = $client->BBANtoBIC(array('Value' => $bban))->BBANtoBICResult;

I've searched for a dutch webservice aswell, but I couldn't find one. But you can always make one yourself with the data from http://www.betaalvereniging.nl/europees-betalen/sepa-documentatie/bic-afleiden-uit-iban/

@Marc Wrobel 2013-07-02 22:19:45

I do not think such library exists (at least for free).

The only reliable way to do this is by using the SWIFT IBAN Plus Directory (formely known as the SWIFT BICplusIBAN Directory.

This directory is provided by SWIFT, which is the IBAN registrar. With it you can match IBAN to various institutions information (including BIC).

The SWIFT IBAN Plus Directory is regularly updated by SWIFT with the latest data, is accessible as a file or via WebService APIs, and unfortunately is not available for free.

@Pavel Niedoba 2016-03-29 11:53:12

I checked the page but cannot see pricing. Do you have any idea how much it could cost ?

@Graviton 2012-10-30 10:20:23

I had a look around and found that you can retrieve the banks name from the iban number with this php iban validator:

http://code.google.com/p/php-iban/

exert from above link

But when you get there you would need an array with all the bank institution codes and corresponding BIC codes.

I think all the BIC codes can be found here:

http://www.nbb.be/doc/gg/Protocol/R_List_of_Codes_Current.pdf

but i'm not sure how you can link the IBAN bank code to the list of BIC codes.

Didn't find a readymade library tough ..

@Wilgert 2013-11-04 17:46:18

For Dutch banks I created this JSON: gist.github.com/wilgert/7305244#file-dutch_banks-json

@Mixxiphoid 2017-08-14 12:42:26

The link to nbb.de is dead. :(

Related Questions

Sponsored Content

32 Answered Questions

[SOLVED] Reference - What does this error mean in PHP?

18 Answered Questions

[SOLVED] Reference — What does this symbol mean in PHP?

1 Answered Questions

[SOLVED] Generate BIC number from IBAN Number

0 Answered Questions

Algorithm to match IBAN to BIC

  • 2018-12-14 18:45:08
  • pandomic
  • 28 View
  • 1 Score
  • 0 Answer
  • Tags:   iban

27 Answered Questions

2 Answered Questions

[SOLVED] How to mask SEPA (IBAN and BIC) information correctly?

  • 2015-02-03 12:38:16
  • devsnd
  • 983 View
  • 0 Score
  • 2 Answer
  • Tags:   payment iban

1 Answered Questions

[SOLVED] Storing SEPA (IBAN and BIC) data - requires PCI compliance?

1 Answered Questions

[SOLVED] PHP Get BIC from IBAN

  • 2017-04-10 12:52:26
  • Kiddo
  • 1026 View
  • -3 Score
  • 1 Answer
  • Tags:   php iban

1 Answered Questions

2 Answered Questions

[SOLVED] Optimize PHP script for generating IBAN

  • 2014-01-16 13:21:42
  • Cikson
  • 921 View
  • 1 Score
  • 2 Answer
  • Tags:   php iban

Sponsored Content