How to Convert Salesforce 15-Digit IDs to 18-Digit IDs: A Complete Guide

How to Convert Salesforce 15-Digit IDs to 18-Digit IDs: A Complete Guide

How to Convert Salesforce 15-Digit IDs to 18-Digit IDs: A Complete Guide

27 Jan 2025

Vasile Fana

When managing Salesforce data, you’ll encounter two types of record IDs: the 15-digit ID and the 18-digit ID. While Salesforce’s internal systems handle both formats seamlessly, external systems like Excel and case-insensitive platforms often require the 18-digit ID to prevent potential data conflicts.

This guide provides a step-by-step overview of how to convert 15-digit IDs to 18-digit IDs using Excel, Salesforce’s CASESAFEID function, and tools like Salesforce Inspector for direct exports.

Why Use the 18-Digit ID?

The 15-digit Salesforce ID is case-sensitive and commonly returned in Salesforce reports. However, many external systems (e.g., Excel) are case-insensitive, meaning they could misinterpret 15-digit IDs that differ only in letter case. The 18-digit ID, which includes a 3-character checksum, resolves this issue by ensuring uniqueness in case-insensitive environments.

If your workflow involves updating or integrating data back into Salesforce or external systems, always use the 18-digit format to avoid mismatched records.

1. Converting 15-Digit IDs to 18-Digit IDs in Excel

If you’ve exported a report from Salesforce with 15-digit IDs, follow these steps to convert them into 18-digit IDs using Excel:

Step 1: Prepare Your Data

  • Column A: Paste your 15-digit Salesforce IDs starting in cell A2.

  • Column B: Use the formula below to generate the corresponding 18-digit IDs.

Step 2: Excel Formula for Conversion

Paste this formula into cell B2 and drag it down for all rows:



2. Using the CASESAFEID Formula in Salesforce

For Salesforce admins, the CASESAFEID function provides a simple and reliable way to convert IDs directly within Salesforce. It’s especially useful for admins who frequently work with custom fields or need to include 18-digit IDs in reports.

CASESAFEID Function Overview

Source: Salesforce Documentation

CASESAFEID
Converts a 15-character ID to a case-insensitive 18-character ID. In Salesforce Classic, the function converts only valid Salesforce 15-character IDs. If you pass in an invalid ID, the function returns the ID passed in. In Lightning Experience, the function converts any 15-character ID.

Use:

Tips:

  • Convert to 18-character IDs for better compatibility with Excel.

  • The CASESAFEID function is available everywhere you can define a formula except reports and s-controls.

  • In Lightning Experience, contact Salesforce Support if you want the function to convert only valid 15-character IDs.

Formula Examples:

  1. CASESAFEID(Id) — Converts the standard object ID to an 18-character ID.

  2. CASESAFEID('A01xx000003DHur') — Returns A01xx000003DHur. The ID isn’t valid because it begins with a capital letter.

  3. CASESAFEID('001xx000003DHur') — Returns something like 001xx000003DHurAAG because the ID passed in is valid.

3. Direct Export of 18-Digit IDs Using Salesforce Tools

Admins can bypass manual conversion and export 18-digit IDs directly using tools like Salesforce Inspector, Workbench, or Data Loader.

Salesforce Inspector (Our recommended tool)

Salesforce Inspector is a powerful browser extension that speeds up data management tasks:

  • Auto-Suggest Fields by API Name: As you type, it auto-suggests field names, eliminating the need to reference the SObject multiple times. This makes query-building faster and more efficient.

  • Multi-Threaded Operations: Unlike tools like Data Loader, Salesforce Inspector supports concurrent operations. For example, you can update 100,000 records in batches of 100 with 5 threads, making it significantly faster than single-thread operations.

  • Direct Export of 18-Digit IDs: Use the Export Data feature to retrieve 18-digit IDs without additional conversion steps.

Workbench

  • Log into Salesforce Workbench.

  • Run a SOQL query like:

    The Id field will return the 18-digit ID.

Data Loader

Export records using Data Loader, which automatically includes 18-digit IDs in the output.

Why This Matters

Using the 18-digit ID ensures data integrity and avoids issues with case-insensitivity, especially when working with external systems or large datasets. Whether you choose Excel formulas, Salesforce-native tools like CASESAFEID, or third-party solutions, having the right format saves time and eliminates errors.

Need Help Managing Your Salesforce Data?

If you’re looking for expert guidance on Salesforce data management, customizations, or mastering tools like Salesforce Inspector, we’re here to help. Contact us to streamline your operations and take your Salesforce usage to the next level.

Final Thoughts

Converting Salesforce 15-digit IDs to 18-digit IDs is a straightforward but essential task for ensuring compatibility with case-insensitive systems. With the CASESAFEID function, Excel formulas, or tools like Salesforce Inspector, you can choose the method that best fits your needs and workflow.