On this page
A large bookmark collection can contain repeated links alongside URLs that look alike but serve different purposes. The safest way to deduplicate browser bookmarks is to back up the collection, find exact URL matches first, and review each match before deleting anything.
Key Takeaways
- Export a backup before editing, and check whether your browser's import process merges bookmarks rather than replacing them.
- An exact URL match identifies a candidate for review, not an automatic deletion. Folder location and context may still matter.
- Different paths, query values, and fragments can point to different content. Similar-looking URLs should not be treated as duplicates without checking.
- URL Diff is for comparing URLs, not for managing a bookmark collection or automatically removing duplicates.
1. Export and preserve a backup
Open your browser's bookmark manager and look for an Export bookmarks option. Browsers differ in where they place this control; search your browser's help for its export instructions if you cannot find it. Save the exported file somewhere you can identify easily, such as a folder named bookmark-backup.
Many browsers export bookmarks as an HTML file. Keep the original file unchanged and make a separate working copy if you want to inspect it. If you use more than one browser or profile, export each collection separately so you know where each backup came from.
An export may not preserve every browser-specific setting or piece of metadata. Also, importing a backup may add bookmarks to an existing collection rather than replace it. Before relying on a restore, check your browser's instructions and, if practical, try importing into a separate profile with sync disabled. Confirm that the folders and bookmarks you need are present.
Sync warning: Changes made in a synced profile may appear on your other devices. Decide which profile and devices you are editing before deleting anything.
Advertisement
2. Understand exact matches and similar URLs
For this workflow, an exact match means the saved URL text is identical after the export file's HTML formatting is read. Two bookmarks can have the same URL but different names or folder locations. Decide whether those differences are useful before removing either bookmark.
Here are fictional examples:
| URL pair | What to consider |
|---|---|
https://example.org/guide and https://example.org/guide | Exact URL match. Check the bookmark names and folders before deleting one. |
https://example.org/guide and https://example.org/guide/ | Different paths. A site might treat them alike, but it might not. |
https://example.org/search?q=birds and https://example.org/search?q=fish | Different query values; they may show different search results. |
https://example.org/manual#install and https://example.org/manual#troubleshoot | Different fragments; they may open different sections or application views. |
https://example.org/account in two browser profiles | The URL is identical, but different sign-in states may show different accounts or content. |
Normalization means transforming URLs before comparing them—for example, changing the capitalization of a hostname or removing a trailing slash. Some transformations may be harmless in a particular case, but others can change meaning. Path capitalization, query parameters, fragments, and encoded characters deserve particular care. Do not delete bookmarks solely because their normalized forms look alike.
Sign-in state also deserves separate attention: cookies and the active account may affect what a page shows even when the URL is the same. A bookmark does not necessarily capture that state.
3. Find exact matches
For a small collection, use your bookmark manager to search for a distinctive part of a URL, then inspect the full saved URL and folder for each result. Search results can include partial matches, so compare the complete URLs before deciding what to remove.
For a large HTML export, the following optional Python script creates a local list of URLs that occur more than once. It reports candidates only; it does not edit the export or your browser bookmarks.
You need Python installed and a browser bookmark export in HTML format. Save this script as bookmark_duplicates.py:
import csv
import sys
from collections import Counter
from html.parser import HTMLParser
class BookmarkLinks(HTMLParser):
def __init__(self):
super().__init__()
self.urls = Counter()
def handle_starttag(self, tag, attrs):
if tag != "a":
return
for name, value in attrs:
if name == "href" and value:
self.urls[value] += 1
break
def main():
if len(sys.argv) != 2:
print("Usage: python bookmark_duplicates.py bookmarks.html", file=sys.stderr)
return 1
try:
with open(sys.argv[1], encoding="utf-8-sig") as source:
parser = BookmarkLinks()
parser.feed(source.read())
parser.close()
except (OSError, UnicodeError) as error:
print(f"Could not read the export: {error}", file=sys.stderr)
return 1
writer = csv.writer(sys.stdout)
writer.writerow(["url", "count"])
for url, count in sorted(parser.urls.items()):
if count > 1:
writer.writerow([url, count])
return 0
if __name__ == "__main__":
sys.exit(main())
In a terminal, go to the folder containing the script and export. Replace bookmarks.html with your export's filename. On macOS or Linux, run:
python3 bookmark_duplicates.py bookmarks.html > duplicate-urls.csv
On Windows, if the Python launcher is installed, run:
py bookmark_duplicates.py bookmarks.html > duplicate-urls.csv
The CSV lists each repeated URL and its count. A file containing only the header means the script found no repeated URL strings. The script reads links in the HTML file, not the live browser collection; it does not report bookmark titles or folder paths. It reads HTML character references in attributes, so an exported & is compared as &. It does not otherwise normalize URLs.
The script was not executed for this article. If it reports an encoding or file error, check the filename and your browser's export format. An error may still leave an empty or incomplete CSV because of the output redirection; do not treat that file as a successful report.
Keep the export and report private: bookmarks can contain personal identifiers, access tokens, or private research links. Inspect the CSV in a plain-text editor if possible; spreadsheet applications can interpret some cell values as formulas.
Advertisement
4. Review and remove duplicates in your browser
Work through the repeated URLs in your bookmark manager:
- Search for one full URL or a distinctive part of it.
- Inspect the saved URL, title, and folder for each result. A search match is not necessarily an exact URL match.
- Keep the bookmark in the most useful location, or keep multiple copies if the folders serve different purposes.
- Delete only the copies you have decided are unnecessary. Repeat in small batches.
- Reopen a few retained bookmarks and check your folder structure. Export a fresh copy after you finish, while retaining the original backup.
If two candidates are not exact matches, compare their full URLs before deciding. URL Diff can help compare URLs, but it is not a bulk bookmark manager or automatic deduplication system. Avoid pasting private URLs into an online service unless you are comfortable with its handling of that data.
Common Mistakes
- Deleting by title alone. Two bookmarks with the same title can have different destinations.
- Removing all query strings or fragments. They can identify a specific search, document section, or application state.
- Assuming a matching URL has matching context. Different profiles, accounts, or folder purposes can make separate bookmarks useful.
- Editing the only backup. Preserve the original export before creating reports or making changes.
- Importing repeatedly to fix a mistake. Depending on the browser, imports may merge and create more duplicates. Check the restore process first.
Best Practices
Start with exact matches, review in small batches, and keep an untouched export until you are satisfied with the result. Treat near-matches as a separate investigation: open them when safe and useful, compare their complete URLs, and retain both when their purpose is unclear.
Conclusion
Deduplicating bookmarks is safest when a report identifies candidates and you make the final decisions in the browser. Preserve a backup, remove only reviewed copies, and leave meaningful URL differences intact.
What would your domain sell for?
A free TidyURLs account unlocks the Domain Estimator. It prices a name from 191,011 real domain sales.