Admins / Developers

Salesforce Id Converter – Change 15-Digit Ids to 18-Digit Ids

By Andreea Doroftei

Every Salesforce record has a unique identifier (Id), which is the one constant characteristic of the record. If you update any field on a record, even the name, Salesforce will still recognize the record based on the Id. The Id is also a key data point in all automated processes and integrations.

There are two Salesforce Record Id formats (15-digit and 18-digit), which are used for different reasons. You may find yourself with the 15-digit Id in Excel, before realizing that you actually need to work with the 18-digit Id to do a VLOOKUP(). This is where Salesforce Id converters come to the rescue!

A Salesforce Id converter is a tool that can turn a 15-digit Id into an 18-digit Id (and vice versa). This guide will cover all possible options for obtaining this data – the pre-built, widely available solutions, as well as how to build your own converter tool.

Differences Between 15-Digit and 18-Digit Ids in Salesforce

Salesforce 15-Digit IdSalesforce 18-Digit Id
Case-sensitive
Not case-sensitive
Used by the Salesforce user interface, i.e. what you can paste in the Salesforce URL to open a record, and the standard field you can pull in Salesforce reports. Used by the Salesforce API because most other platforms do not respect case sensitivity (e.g. they consider ABC the same as abc).
Also present in the URL when opening a Salesforce record.

What are the extra three digits?

The last three digits of an 18-digit Salesforce Id are a checksum of the first 15 characters.

If you’re looking for more information on the parts that form a Salesforce Id, check out this response on the StackExchange.

How to Convert a 15-Digit Id to an 18-Digit in Salesforce

Option 1: Salesforce Formula Field

Salesforce’s official recommendation is to create a formula field to obtain the 18-digit Id and then call it a day. The formula to convert Salesforce Ids (which you might have already encountered in the functions list) is CASESAFEID(Id).

However, there are a few important things to consider:

  • The formula field needs to be created as a custom field on all of the standard and custom objects you need the 18-digit Id on.
  • You need to make sure the field appears on all relevant report types and that view permissions are granted.
  • Users need to be trained to use the new field and to modify their existing reports to include it.
  • For larger orgs (that have a process in place), the field will need to be built in a sandbox and deployed to production.

Considering the factors above, there are faster and more efficient (as well as more scalable) ways to get the job done if the 18-digit Salesforce Id is required.

Option 2: Build Your Own

Javascript Browser Bookmarklet is another Salesforce recommendation. Use the Javascript code to add the following bookmarklet in your browser to manually convert Ids at any time.

While this solution works and doesn’t imply metadata changes to your Salesforce instance, you will always have to copy and paste the Ids you wish to convert.

Note: This may not work in Microsoft Edge.

Option 3: Use an Online Tool

A few bright Trailblazers jumped to fill this gap with online tools (which you can use for free). Here’s how they work: An admin copies and pastes Salesforce Ids into the converter, then copies the results to wherever they are required.

Option 4: Convert Ids in Excel

While online tools are a quick solution for converting multiple Ids all at once, they don’t hit the mark when working with hundreds or even thousands of records in a CSV. or Excel file. Can you imagine the copy and paste nightmare?

That’s why a tool that converts Ids right within the CSV./Excel spreadsheet you’re working from could save you from an admin headache!

XL-Connector by Xappex

As a more robust third-party solution, the XL-Connector (which can be leveraged either in Excel or Google Sheets) raises the bar when it comes to converting Salesforce Ids.

Convert Ids

We have all had our fair share of ‘fun’ with Salesforce Ids – finding that you have the wrong Id when doing data management (e.g. record updates in mass) can be very frustrating.

While the manual approach works in most cases, what if we need an 18-character Id in a spreadsheet quickly? And what if we have a sheet with over 1000 rows? In XL-Connector, the conversion is literally one button away.

The Id conversion feature is part of the XL-Connector’s free offering, so a license won’t be needed – simply select all cells containing the Id (without the header), click the button, and voilà!

Retrieve and Update Salesforce Records

The simple fact that you can bulk-convert however many Ids from 15 to 18 characters in a matter of seconds directly in the Excel file is cool enough, but what if you could get them within your file whenever you needed?

The convert Ids function is one of many that the XL-Connector has to offer. If you’re working on a file and find yourself in need of Salesforce data, you can obtain this by querying your Salesforce org – either choose the fields or manually write the SOQL query.

Not only can you get the data you need (in this case the Ids), but you can also update the Salesforce data immediately with new information you have in the spreadsheet. In this simple example, I chose to query the Account Object, get the Id, then update all records with a new Website value.

Considering it can help you get the job done in a single application, the Xappex XL-Connector can become a valuable asset very quickly – there’s no need to use multiple tools.

Summary

There will always be times when you need to convert a Salesforce 15-digit Record Id to the 18-digit version, but it’s important to be aware of all possible options to ensure you choose the best one for your use case.

Whether you go with the simple formula field, a browser-based solution, or a third-party option such as Xappex, Ids are not going anywhere anytime soon, and will always be a key factor when manipulating Salesforce data.

The Author

Andreea Doroftei

Andreea is a Salesforce Technical Instructor at Salesforce Ben. She is an 18x certified Salesforce Professional with a passion for User Experience and Automation. 

Comments:

    Bart
    May 04, 2022 3:35 pm
    I like this one: https://www.adminbooster.com/tool/15to18
    Ben Jackson
    May 04, 2022 8:32 pm
    Correction for this post, the 18 digit id is in the record URL and not the 15 digit id, if you use the 15 digit id it will redirect correctly to the record and present the 18 digit id. Formula CASESAFEID function is a personal favourite
    Aaron King
    May 05, 2022 7:11 pm
    Kids these days have it so easy with the CASESAFEID() function. Back in the day we had to make this formula: Id & MID("ABCDEFGHIJKLMNOPQRSTUVWXYZ012345",( IF(FIND(MID(Id,1,1), "ABCDEFGHIJKLMNOPQRSTUVWXYZ")>0,1,0) +IF(FIND(MID(Id,2,1), "ABCDEFGHIJKLMNOPQRSTUVWXYZ")>0,2,0) +IF(FIND(MID(Id,3,1), "ABCDEFGHIJKLMNOPQRSTUVWXYZ")>0,4,0) +IF(FIND(MID(Id,4,1), "ABCDEFGHIJKLMNOPQRSTUVWXYZ")>0,8,0) +IF(FIND(MID(Id,5,1), "ABCDEFGHIJKLMNOPQRSTUVWXYZ")>0,16,0) )+1,1) & MID("ABCDEFGHIJKLMNOPQRSTUVWXYZ012345",( IF(FIND(MID(Id,6,1), "ABCDEFGHIJKLMNOPQRSTUVWXYZ")>0,1,0) +IF(FIND(MID(Id,7,1), "ABCDEFGHIJKLMNOPQRSTUVWXYZ")>0,2,0) +IF(FIND(MID(Id,8,1), "ABCDEFGHIJKLMNOPQRSTUVWXYZ")>0,4,0) +IF(FIND(MID(Id,9,1), "ABCDEFGHIJKLMNOPQRSTUVWXYZ")>0,8,0) +IF(FIND(MID(Id,10,1), "ABCDEFGHIJKLMNOPQRSTUVWXYZ")>0,16,0) )+1,1) & MID("ABCDEFGHIJKLMNOPQRSTUVWXYZ012345",( IF(FIND(MID(Id,11,1), "ABCDEFGHIJKLMNOPQRSTUVWXYZ")>0,1,0) +IF(FIND(MID(Id,12,1), "ABCDEFGHIJKLMNOPQRSTUVWXYZ")>0,2,0) +IF(FIND(MID(Id,13,1), "ABCDEFGHIJKLMNOPQRSTUVWXYZ")>0,4,0) +IF(FIND(MID(Id,14,1), "ABCDEFGHIJKLMNOPQRSTUVWXYZ")>0,8,0) +IF(FIND(MID(Id,15,1), "ABCDEFGHIJKLMNOPQRSTUVWXYZ")>0,16,0) )+1,1)
    Andreea D
    May 06, 2022 10:56 am
    Hey Aaron :) Thank you for sharing, the progress on ways to convert Ids compared to the above formula is definitely undeniable. We have it much easier these days!
    Andreea D
    May 06, 2022 11:00 am
    Hello Ben Thank you for pointing this out! Updated the table accordingly to make it clear how the 15 digit can be used in the URL.

Leave a Reply