Validate IBAN numbers
Latest commit c4ee6e0 Oct 27, 2016 @iulianu committed on GitHub Merge pull request #23 from prokopsimek/add-missing-countries
Added 11 missing countries


iban-tools is a Ruby library for manipulating and validating IBAN account numbers. You can read more about IBAN on Wikipedia


Iulianu wrote iban-tools. We just removed use of String#ord for compatibility with Ruby 1.8 and 1.9 and of course pushed the built gem to gemcutter.

You'll find the source code on Github. Our fork is also available on GitHub

The gem should be compatible with Ruby 1.8.6, 1.8.7 and 1.9.1.


You'll need to add as a gem source if you don't already have it.

You can accomplish this with the gemcutter gem.

gem install gemcutter
gem tumble

Once you have the gemcutter source added you can install iban-tools with a simple gem install.

gem install iban-tools


require 'rubygems'
require 'iban-tools'

IBANTools::IBAN.valid?("GB82 WEST 1234 5698 7654 32")
=> true

Advanced usage, gives more detailed error messages"XQ75 BADCODE 666").validation_errors
=> [:unknown_country_code, :bad_check_digits]

Pretty print, canonicalize, and extract fields from an IBAN code

iban =" ro49  aaaa 1B31007593840000")

=> "RO49AAAA1B31007593840000"

=> "RO"

=> "RO49 AAAA 1B31 0075 9384 0000"