Print this page

How unique IDs work in Salesforce

Knowledge Article Number 000004383
For all entity types, every record has an ID field that uniquely identifies that record. The value for the ID field is created automatically upon insert, and it cannot change over the lifetime of that record, even if the record is deleted and then undeleted. Each ID value is guaranteed to be globally unique. The ID of a record is the best way to uniquely identify that record.

To illustrate, when you're viewing a record within Salesforce via a browser, the URL to the record is composed of the instance and the record ID.  

For example:, where "5003000000D8cuI" is the record ID and "na1" is the instance. 


API Versions

Note: You must be an Enterprise Edition or Unlimited Edition customer to have API access.

API versions prior to 2.0: The ID of a record is always a 15-character case-sensitive ID and should not be compared in a case-insensitive manner.

API versions 2.0 and higher: The API can return either a case-sensitive or a case-insensitive ID field value. The case-insensitive ID is identical to the 15-character case-sensitive ID with three extra characters appended to indicate the case of each of the original 15 characters. When inserting or updating records, the API accepts either the 15-character case-sensitive ID or the 18-character case-insensitive ID. When querying or searching records using the API, you must specify a value of "1" for the "useCaseSafeIDs" parameter to indicate that you want the API to return case-insensitive IDs. If you do not specify the "useCaseSafeIDs" parameter, you automatically receive case-sensitive IDs.

API 2.5: Defaults to 18 characters on the ID (case safe) and provides no option to use the 15-character ID explicitly.

The "Reports" tool queries the database directly and therefore returns a 15-character case-sensitive ID.  Tools such as the Data Loader, Demand Tools or the Weekly Data Export service will export records with the 18-character ID.


Helpful info from the API Developer's Guide

You'll find this info under 'Field Types - ID Field Type.'

  • ID fields in the Salesforce user interface contain 15-character, base-62, case-sensitive strings. Each of the 15 characters can be a numeric digit (0-9), a lowercase letter (a-z), or an uppercase letter (A-Z). Two unique IDs may only be different by a change in case.
  • Because there are applications like Access which do not recognize that 50130000000014c is a different ID from 50130000000014C, an 18-digit, case-safe version of the ID is returned by all API calls. The 18 character IDs have been formed by adding a suffix to each ID in the API. 18-character IDs can be safely compared for uniqueness by case-insensitive applications, and can be used in all API calls when creating, editing, or deleting data.
  • If you need to convert the 18-character ID to a 15-character version, truncate the last three characters. Salesforce recommends that you use the 18-character ID.

Good to know: The 18-character reference IDs are just case-safe. For instance, if you fire a SOQL query for record ID "00330000000xEftMGH" and "00330000000xEftmgh," The latter will give no results. This means that they are case sensitive in Salesforce. But when used with tools like Excel/Access, you can devise methods to produce case-safe IDs as per the points below.

promote demote