Duplicate data in any system leads to operational inefficiencies. Duplicate rules are used to prevent the duplicate records. In Salesforce classic, if there are any duplicate accounts and contacts, it will display error message only. There are options to either allow and block the duplicate records. However, now we can detect and merge duplicate accounts and contacts in Lightning experience. It helps us maintain good bonding with customers and keep our accounts and contacts clean. If permission is given to merge records in classic, the same could be used in lightning too. This feature is available in Lightning Experience only.
The following steps to be followed to detect merging of duplicate records:
Step 1:In setup enter App Builder and click Lightning App Builder.
Step 2:Choose record page and select the object which you want.

Fig 1: select record page
Step 3: Click Potential Duplicates which is used to alert duplicate and select the display options. You can select show toast or show card or show both.

Fig 2: select potential duplicate and display options
Step 4: Save and Activate.
Step 5: Make sure the Duplicate and Matching rules are active. Click View Duplicates to show the duplicate records.

Fig 3: View duplicates
Step 6: We can choose up to three records to merge. Before merging, choose the correct value for each field.

Fig 4: select accounts to merge
When merging, the master record is updated with the values which you have chosen and relationships to other items are moved to the master record.

Fig 5: correlate the accounts
Step 7: Click Merge Accounts to merge the records. Once merged, the record cannot be reverted.

Fig 6: Merge Accounts
Considerations:
When merging, the duplicate records keep these following considerations.
- Lightning experience doesn’t support for merging person accounts.
- One can choose the master account to establish the hierarchy in lightning, whereas in classic the merged account retains the account hierarchy from the master record.
- In Lightning, the contact could be merged with different primary account except for the contact which is associated with a portal user. But in classic the contacts could only be merged with its corresponding primary account.
- Salesforce displays a message to remove the redundant relationship when trying to merge contacts that are indirectly related to the same account. On the other hand, in contact records, the indirect relationships are maintained the related account list.
Reference: