How to Find and Merge Duplicate Records in Salesforce
A full workflow for cleaning up duplicate accounts, contacts, and leads in Salesforce - the native merge tool, its record limits, and the SOQL to find what it can't show you.
Updated 2026-09-09
Merging is the second half of deduplication - finding the duplicates is a query, merging them is a decision about which record wins. Salesforce's native merge tool handles the mechanics; the judgment about which record to keep is still yours.
This covers the native merge flow, its limits, and how to build the worklist it does not generate for you.
Step 1 - build the worklist with SOQL
The native merge screen needs you to already know which records collide. GROUP BY ... HAVING COUNT(Id) > 1 produces that list from the actual data rather than from Salesforce's duplicate rules, which only catch new records going forward.
SELECT Name, COUNT(Id) total
FROM Account
GROUP BY Name
HAVING COUNT(Id) > 1
ORDER BY COUNT(Id) DESCStep 2 - the native merge flow
- Accounts, contacts, and leads each have their own merge screen, reached from the record's detail page (Accounts and Contacts) or from a list view (Leads, which supports merging up to 3 at once).
- You pick a master record and, field by field, which value survives where the records disagree.
- Related records - opportunities, cases, activities - are reparented to the surviving record automatically.
- The merge is permanent. There is no unmerge; the losing record's ID redirects to the winner's, which is why an export beforehand matters.
Step 3 - what the native tool cannot do
- Accounts and contacts merge two or three at a time; a worklist of 200 duplicate names means 200 manual merges unless you script it via the API.
- There is no native bulk-merge UI - large-scale deduplication projects use the Bulk API or a dedicated data-quality tool instead.
- Custom objects have no merge screen at all. Deduplicating a custom object means exporting, deciding a winner, reparenting children by hand, and deleting the loser.
Prevent the next batch
Merging without fixing intake means doing this again next quarter. Salesforce's duplicate and matching rules catch new duplicates at save time with fuzzy matching - exact-match SOQL and native merge only clean up what already got in.
Frequently asked questions
- Can I undo a Salesforce record merge?
- No. The merge is permanent - the losing record's ID becomes an alias that redirects to the surviving record. Export the pre-merge values first if you need a record of what was lost.
- How many records can I merge at once?
- Accounts and contacts merge two at a time from the detail page. Leads merge up to three at once from a list view. There is no native bulk-merge screen for any object.
- Does merging fire automation?
- Yes - triggers, flows, and workflow rules on the affected objects and on any related records that get reparented can fire during a merge, the same as any other DML operation.
More from the Admin How-To
- Change Sets vs Metadata API Deployments: Which to UseChange sets and Metadata API / CLI deployments solve the same problem differently. Here is when each one is the right choice, and what a change set genuinely cannot do.
- How to Check Field-Level Security in Salesforce FastCheck field-level security in Salesforce without clicking through Setup: where FLS lives, how it interacts with profiles and permission sets, and faster ways to read it.
- How to Check Salesforce Org LimitsCheck Salesforce org limits - API calls, data storage, file storage, and daily email - from Setup, the limits API, and the browser, before you hit them.
- How to Compare Two Profiles in SalesforceCompare two Salesforce profiles field by field: the native Setup route, the permission types worth diffing, and how to keep the result auditable.
- How to Create and Deploy a Salesforce Change SetStep by step: create an outbound change set, upload it, and deploy it as an inbound change set - plus the deployment connection you need between orgs before any of it works.
- How to Create Multiple Custom Fields in Salesforce QuicklyCreate custom fields in Salesforce in bulk - the Setup wizard, metadata deployment, and in-browser field creation - plus the naming rules to settle first.
Related reading
- SOQL LibrarySOQL Query to Find Duplicate Accounts by NameFind duplicate accounts in Salesforce with a GROUP BY / HAVING SOQL query on Name, then pull the underlying record IDs.
- SOQL LibrarySOQL Query to Find Duplicate Contacts by EmailFind duplicate contacts in Salesforce with a GROUP BY / HAVING SOQL query on Email, then pull the underlying record IDs.
- SOQL LibrarySOQL Query to Find Duplicate Leads by EmailFind duplicate leads in Salesforce with a GROUP BY / HAVING SOQL query on Email, then pull the underlying record IDs.
- SOQL LibrarySOQL Query to Find Duplicate Products by ProductCodeFind duplicate products in Salesforce with a GROUP BY / HAVING SOQL query on ProductCode, then pull the underlying record IDs.