Introducing the New and Improved Match My Email Dashboard. View announcement.

Introducing Automated Calendar Sync.
Schedule a demo today.

MME Technology Blog

Everything You Need to Know about 15 and 18-Character Salesforce IDs

Every Salesforce record has a unique ID. This ID serves as a unique identifier for the record and remains constant. No matter what information you change on the record, even the name, the ID will stay the same, and Salesforce will recognize the record based on its ID.

The problem is that Salesforce uses two record ID formats – a 15-character ID and an 18-character ID. What makes it even more confusing is that these Salesforce IDs are used for different purposes. This means you could work with a 15-character ID, only to realize later that you actually need an 18-character ID.

In this post, we’ll look at Salesforce 15 to 18 IDs in more detail and show you how to prevent (and solve) problems.
 

What’s the Difference Between Salesforce 15 to 18 Character IDs?

You’re probably wondering why Salesforce needs two record IDs. So, let’s start by looking at the differences between these two IDs because we promise there’s actually a very logical reason for using this system.

If you look closer, you’ll see that the first 15 characters are identical for both IDs. The reason for this is to ensure that the IDs are sensitive while, at the same, being capable of being used in different systems where case sensitivity isn’t necessarily a requirement.

Here, 15-character IDs are case-sensitive and used by Salesforce. In other words, these are the IDs you’ll use to find records on the Salesforce platform.

Conversely, 18-character IDs are used by the Salesforce API to enable data exchange with external platforms because, unlike Salesforce, most other platforms that integrate with Salesforce don’t need case-sensitive IDs.
 

When Should You Use Each Salesforce ID?

Now that we’ve looked at a broad overview of the different Salesforce IDs, the next question we should look at is: When should you use which ID?

If you’re uncertain if the system, platform, or tool you’re working with is case-sensitive, you can always opt for the extended, 18-character version of the Salesforce ID. That’s why, as mentioned earlier, the Salesforce API uses an 18-character ID at all times.

However, in some places, you can only get the 15-character ID. For instance, when you export a report or display an ID somewhere in Salesforce, you’ll get the 15-character version.
 

How to Convert a 15-Character ID to an 18-Character ID in Salesforce

We mentioned earlier that you might use a 15-character ID and then realize later that you need an 18-character ID. So, what do you do in situations like these? The simple answer is to convert Salesforce 15 to 18 IDs. There are 4 methods for converting them:

Method 1: Convert Salesforce 15 to 18 IDs Using Salesforce’s Formula Field

Salesforce’s official recommendation is to create a formula field that will convert a 15-character ID to an 18-character ID when necessary. The process varies depending on whether you use Salesforce Lightning or Classic.

To do this on Salesforce Classic, here are the steps you’ll follow:

  • Go to Setup, then to Customize, and select the object name. You’ll then click on Fields. For custom objects, you’ll go to Setup, then Create, then Objects, and then select the object.
  • In the Custom Fields & Relationships related field, you’ll then click on New.
  • Click on New, and then click on the Formula radio button.
  • For the Formula Return Type, click the Text radio button.
  • You’ll then input the formula, CASESAFEID(Id) into the Formula Editor.
  • Set the Field Visibility, add, or remove from the page layout.
  • You’ll then click Save to finish.

 
To the same on Salesforce Lightning, here are the steps you’ll need to follow:

  • Go to Setup, then Object Manager, then Object name, and, finally, Field & Relationships.
  • You’ll then click on New.
  • Click on the Formula radio button and then on Next.
  • You’ll then click on the Text radio button for Formula Return Type.
  • In the Formula Editor, input the formula CASESAFEID(Id).
  • Set the Field Visibility, add, or remove from the page layout.
  • Once done, you can click on Save.

 
While this is the recommended method, there are some things you should be aware of. For one, you’ll need to create this formula as a custom field on all the standard and custom objects you’d like to use the 18-character ID on. You’ll also need to ensure that the field appears on the relevant report types and that view permissions have been granted. In turn, all users will have to be trained to use the formula field and modify their existing reports to include it.

So, while the Salesforce method allows you to convert 15-character IDs to 18-character IDs easily, it’s not the fastest or most efficient.
 

Method 2: Using Your Browser to Convert Salesforce 15-Digit IDs to 18-Character IDs

Apart from using the method above, Salesforce also recommends using a JavaScript Browser Bookmarklet to manually convert a 15-character ID to an 18-character ID. To do this, you’ll create a new bookmark in your Internet browser and give it a name. You’ll then add this code to the URL:

javascript:(function(){
var input=prompt('Enter 15-character ID');
var output;
	if(input.length == 15){
		var addon="";
		for(var block=0;block<3; block++)
		{
			var loop=0;
			for(var position=0;position<5;position++){
				var current=input.charAt(block*5+position);
				if(current>="A" && current<="Z")
					loop+=1<<position;
			}
			addon+="ABCDEFGHIJKLMNOPQRSTUVWXYZ012345".charAt(loop);
		}
		output=(input+addon);
	}
	else{
		alert("Error : "+input+" isn't 15 characters ("+input.length+")");
		return;
	}
prompt('18-character ID:',output);
})();

Once done, you’ll save the bookmark. To use the converter, you’ll click on the bookmark to open it, enter or paste the 15-character ID and then click OK. Once converted, you can copy the 18-character ID.

While this is a viable alternative to the method mentioned above, it’s not without challenges. For instance, you’ll need to copy and paste every single ID you’d like to use. So, like the earlier method, it’s not exactly efficient. Moreover, this option might not work in Microsoft Edge.
 


 

Method 3: Using Online Tools

Apart from the methods mentioned above, you can also use several online tools to convert 15-character IDs to 18-character IDs. With tools like AdminBooster, you’ll typically copy and paste Salesforce IDs into the tool and copy the converted results again once the tool finishes the conversion.

As a bonus, these tools are generally also free to use.
 

Method 4: Converting IDs in Excel

All the methods we mentioned above are ideal when you’d like to convert a few IDs. However, they don’t work well when you’d like to do the same with hundreds or thousands of IDs in a CSV or Excel file. Simply put, when using these tools, you’ll be copying and pasting IDs for quite some time. So, in this case, you’ll need a way to do this in Excel.

One of the ways is to write your function in Excel. Typically, a formula like this will use a lookup table to convert the ID by adding three digits to make up the 15-character ID. Now, if you’re an advanced Excel user, this might not be a problem.

However, if you’re not an advanced user, a better option might be to use a dedicated tool. One example of such a tool is Xappex’s XL-Connector. When installed, it gives you an ID conversion button right in Excel. So, if you need to convert a single ID, you’ll click this button to convert it in place. Likewise, you'll do the same if you need to convert 1,000 IDs. A significant benefit of this is that this functionality is completely free.

However, the features don’t stop there. Apart from allowing you to convert as many IDs as you’d like in seconds, the tool also allows you to get these converted IDs in an Excel file. In other words, the tool will enable you to query your Salesforce org from within Excel. You can also write updated data to Salesforce.

Considering these benefits and compared to methods mentioned earlier, a tool like XL-Connector might be your best option. It could become one of the most valuable tools in your arsenal, as is often the case with Salesforce AppExchange apps and additional tooling that improves your Salesforce productivity.
 

Streamline How You Use Salesforce

Salesforce has its quirks, but we hope this post has shown you the essential methods for converting Salesforce 15 to 18-character IDs. The next time you’re in a situation where your ID isn’t enough, you’ll know exactly what to do! After all, Salesforce is a fantastic tool, but everyone needs a little guidance to make the most of it.

Try Match My Email today.