Salesforce 15 Digit vs 18 Digit ID

Salesforce uses a 15/18 digits unique id to identify each record. These ids which we can see in the URL are 15 digit case sensitive id whereas the API returns an 18 digit case insensitive id.

The reason why we needed an 18 digit id was due to limitations in Excel VLOOKUP formulas and many legacy systems, which works only with case insensitive ids. The last 3 digits are checksum of the 15 digits ID

Understanding the conversion of 15 to 18 digit ID –

Lets say the 15 digit id – 0019000000oC4Hk.
Divide the 15 digit id in 3 groups of 5 digit.
00190     00000    oC4Hk

Reverse  the digits in the groups
09100     00000    kH4Co

Replace the uppercase A-Z alphabets with 1 and make the rest digits as 0
00000     00000    01010

Now find the corresponding checksum alphabets/digits for the 3 groups.
00000-A       01000-I       10000-Q     11000-Y
00001-B       01001-J         10001-R     11001-Z
00010-C       01010-K       10010-S      11010-0
00011-D       01011-L         10011-T      11011-1
00100-E       01100-M      10100-U     11100-2
00101-F       01101-N        10101-V       11101-3
00110-G      01110-O        10110-W      11110-4
00111-H       01111-P         10111-X        11111-5
So the last 3 digits become – AAK and the 18 digit id becomes – 0019000000oC4HkAAK

There are other easy ways of converting 15 to 18 digit ID –
Salesforce has a formula field function CASESAFEID(id) which converts 15 digit to 18 digit ID.
There is a excel connector available which can be installed to convert 15 digit to 18 digit ID.
For easy and fast access one can download the chrome plugin at here.

One thought on “Salesforce 15 Digit vs 18 Digit ID

Leave a comment