How to Compare Two URL Lists and Find Missing or Unexpected Pages

Compare planned and live URL lists with cautious normalization. Find missing, added, and duplicate pages while keeping source URLs and private data in view.

Published
Reading time
9 min read
How to Compare Two URL Lists and Find Missing or Unexpected Pages
On this page

A release checklist and a live crawl rarely contain exactly the same URLs. Comparing them can reveal pages that are missing, newly exposed, or listed more than once—but only if you decide what counts as the same URL before you compare. This workflow keeps original values for review, applies cautious normalization, and separates missing, added, and duplicate entries without assuming the lists should match perfectly.

Key Takeaways

  • Treat the planned list and live crawl as separate inventories with different purposes; differences are findings to investigate, not automatic failures.
  • Preserve each original URL and compare a separate, documented comparison key.
  • Normalize only differences you have decided are irrelevant. Hostname case and default ports are often safe to normalize; paths, query strings, and trailing slashes may be meaningful.
  • Report missing URLs, added URLs, and duplicates separately, then review context before deciding what to fix.
  • Remove credentials and private query values before sending URLs to an online comparison tool.

Start with two clearly defined inventories

Choose a source for each list and record how it was created. For example:

  • Planned: URLs from the approved launch spreadsheet or content management system export.
  • Live: URLs discovered by a crawl of the staging or production site.

Record the crawl date, environment, scope, and any crawl exclusions. A crawl that cannot access a page behind authentication, or that stops at a page limit, is not a complete inventory. Likewise, a launch list may intentionally include redirects, pages that are not linked in navigation, or URLs scheduled for a later release.

Keep one URL per line if you are using plain-text files. Avoid editing either source list in place; save a working copy and retain the source files so every finding can be traced back to its origin.

Decide what “the same URL” means

A URL can have several spellings that may or may not identify the same page for your project. For example, hostnames are case-insensitive, and an explicit default port is usually equivalent to omitting it. Other differences can matter:

  • /guide and /guide/ may be treated differently by the server.
  • Query parameters can select content, language, filters, or tracking information.
  • Fragments usually identify a location within a page, but some client-side applications use them for routing.
  • Redirects can make two distinct URLs lead to the same destination, but that does not make the original URLs identical.

Write down the normalization rules before comparing. A cautious starting point is to trim accidental surrounding whitespace, lowercase the scheme and hostname, remove the default port, and ignore fragments if your inventory is about server pages. Keep paths and query strings unchanged unless you have a specific reason to compare them differently. Do not sort query parameters or remove trailing slashes by default.

Keep the raw value beside the comparison key. That way, when a match or difference needs review, you can see exactly what appeared in each source.

Advertisement

Compare the lists and classify the results

Use three separate findings:

  • Missing: A normalized URL appears in the planned list but not in the live crawl. Check whether the page is unpublished, blocked from crawling, out of scope, or genuinely missing.
  • Added: A normalized URL appears in the live crawl but not in the planned list. It may be an intentional existing page, a newly generated URL, a staging artifact, or an unexpected page.
  • Duplicate: The same normalized URL appears multiple times within one source. This can indicate duplicate rows, repeated crawl discoveries, or distinct raw URLs collapsed by your chosen normalization rules.

Duplicates are not the same as differences between lists. Report duplicates within each inventory, and compare unique normalized keys for missing and added results. Do not assume an added URL is unwanted or that every planned URL must be crawlable; use release scope and crawl behavior to interpret each item.

A local Python comparison script

This Python 3 script reads one URL per line from two text files. It retains raw entries for display and creates a separate comparison key. By default it removes fragments, preserves query strings and paths, lowercases scheme and hostname, and removes the default HTTP or HTTPS port. It reports invalid or unsupported lines rather than silently treating them as valid URLs.

Save it as compare_urls.py:

import argparse
from collections import defaultdict
from urllib.parse import urlsplit, urlunsplit


def comparison_key(raw_url, ignore_query=False, keep_fragments=False):
    value = raw_url.strip()
    parts = urlsplit(value)
    scheme = parts.scheme.lower()

    if scheme not in {"http", "https"}:
        raise ValueError("only absolute HTTP and HTTPS URLs are supported")
    if not parts.hostname:
        raise ValueError("URL has no hostname")
    if "@" in parts.netloc:
        raise ValueError("URLs containing user information are not accepted")

    host = parts.hostname.lower()
    port = parts.port  # Can raise ValueError for an invalid port.
    if ":" in host:  # Add brackets back around an IPv6 address.
        host = f"[{host}]"
    if port is not None and not (
        (scheme == "http" and port == 80)
        or (scheme == "https" and port == 443)
    ):
        host = f"{host}:{port}"

    path = parts.path or "/"
    query = "" if ignore_query else parts.query
    fragment = parts.fragment if keep_fragments else ""
    return urlunsplit((scheme, host, path, query, fragment))


def load_urls(filename, ignore_query=False, keep_fragments=False):
    entries = defaultdict(list)
    errors = []

    with open(filename, encoding="utf-8") as source:
        for line_number, line in enumerate(source, start=1):
            raw_url = line.strip()
            if not raw_url:
                continue
            try:
                key = comparison_key(
                    raw_url,
                    ignore_query=ignore_query,
                    keep_fragments=keep_fragments,
                )
                entries[key].append(raw_url)
            except ValueError as error:
                errors.append((line_number, raw_url, str(error)))

    return entries, errors


def show_duplicates(label, entries):
    groups = [(key, values) for key, values in entries.items() if len(values) > 1]
    print(f"\n{label} duplicate groups: {len(groups)}")
    for key, values in sorted(groups):
        print(f"  {key} ({len(values)} entries)")
        for value in values:
            print(f"    raw: {value}")


def main():
    parser = argparse.ArgumentParser(
        description="Compare planned and live URL lists."
    )
    parser.add_argument("planned", help="text file containing planned URLs")
    parser.add_argument("live", help="text file containing live-crawl URLs")
    parser.add_argument(
        "--ignore-query",
        action="store_true",
        help="ignore query strings when comparing URLs",
    )
    parser.add_argument(
        "--keep-fragments",
        action="store_true",
        help="include fragments in comparison keys",
    )
    args = parser.parse_args()

    planned, planned_errors = load_urls(
        args.planned, args.ignore_query, args.keep_fragments
    )
    live, live_errors = load_urls(
        args.live, args.ignore_query, args.keep_fragments
    )

    missing = sorted(planned.keys() - live.keys())
    added = sorted(live.keys() - planned.keys())
    print(f"Missing from live crawl: {len(missing)}")
    for key in missing:
        print(f"  {key} | planned raw: {planned[key]}")
    print(f"Added in live crawl: {len(added)}")
    for key in added:
        print(f"  {key} | live raw: {live[key]}")

    show_duplicates("Planned", planned)
    show_duplicates("Live", live)

    for label, errors in (("planned", planned_errors), ("live", live_errors)):
        if errors:
            print(f"\nInvalid entries in {label} list: {len(errors)}")
            for line_number, raw_url, message in errors:
                print(f"  line {line_number}: {raw_url!r} ({message})")


if __name__ == "__main__":
    main()

Run it with two files:

python compare_urls.py planned.txt live.txt

If query parameters are known to be irrelevant to page identity for this comparison, add --ignore-query. Use --keep-fragments only if fragments represent distinct routes in your application. Those options change the comparison rules; they do not determine whether the resulting URLs are valid or accessible.

For example, if planned.txt contains https://example.com/about and https://example.com/launch, while live.txt contains https://example.com/about and https://example.com/news, the script reports /launch as missing and /news as added. Review the raw values and the crawl scope before assigning either item as a defect.

Advertisement

Review findings against release intent

Work through results in a consistent order:

  1. Check the comparison rules. Confirm that query strings, fragments, path case, and trailing slashes were handled as intended. If a normalization rule merged URLs, inspect the raw values in that group.
  2. Check crawl coverage. Verify the crawl used the expected host and environment, followed the intended links, and was not limited by robots rules, authentication, exclusions, or crawl limits.
  3. Investigate missing entries. Open the page in the target environment and check publication state, redirects, access requirements, and whether the URL was included in crawl scope.
  4. Investigate added entries. Check whether the URL is an expected existing page, a parameterized variant, a test or staging page, or a page created outside the launch plan.
  5. Resolve duplicates deliberately. Remove accidental duplicate rows, but retain distinct raw URLs when their differences are meaningful. If they normalize to the same key, confirm that collapsing them was appropriate.
  6. Save the outcome. Record the finding, decision, owner, and follow-up action. Keep the original inventories and the normalization rules with the release record.

A URL comparison reports string-level differences under your chosen rules; it does not confirm page content, response status, canonical tags, redirects, or whether a page is indexable. Use a crawler, browser, or HTTP checks for those separate questions. For a quick interactive comparison, you can also use [URL Diff](URL Diff); review the data-handling implications before submitting a list.

Protect private URL data

URLs can contain credentials, session identifiers, email addresses, search terms, and other private values—often in query strings. Before using an online comparison tool:

  • Remove username and password components and redact private query values.
  • Replace sensitive values consistently in both lists if they must still be compared; for example, substitute a non-secret placeholder rather than deleting a parameter from only one side.
  • Check whether hostnames, paths, or query parameters disclose internal systems or confidential project details.
  • Follow your organization's data-handling rules and the tool's privacy policy. If you cannot share the data, compare it locally with an approved script or environment.

The script above rejects URLs containing user information, but it does not redact query values. Its output includes raw URLs and normalized keys, so run it only where those values are permitted and protect any saved console output. Removing a secret from a URL list does not revoke it; rotate exposed credentials or tokens if needed.

Common Mistakes

  • Comparing raw strings without a policy: Harmless hostname case or default-port differences can create noise, while aggressive normalization can hide real changes.
  • Removing every query string: Query parameters may select a page variant or content. Ignore them only when that matches the release question.
  • Treating a crawl as a complete sitemap: Crawl scope, access, and discovery affect what appears in the live inventory.
  • Calling every added URL a defect: A live crawl may include valid pages that were outside the planned launch list.
  • Deduplicating before preserving the source values: Keep raw entries so reviewers can distinguish repeated rows from URLs that only became equivalent after normalization.
  • Sharing sensitive URLs casually: Query values and credentials can expose private data even when a URL looks ordinary.

Best Practices

  • Keep immutable copies of both input lists, along with source, environment, date, and scope notes.
  • Define normalization once and apply the same rules to both inventories.
  • Preserve raw URLs next to comparison keys and report duplicates separately for each source.
  • Start with conservative normalization; investigate before ignoring query strings, fragments, trailing slashes, or path differences.
  • Treat comparison output as a review queue, not a release verdict. Validate important findings against the live site and the release plan.
  • Store the decision and follow-up for each confirmed mismatch so the same issue is not rediscovered without context.

Conclusion

A useful comparison depends on clear inventory scope and cautious normalization. Preserve the original URLs, separate missing, added, and duplicate results, and review each difference against the release plan and crawl coverage. That makes the comparison repeatable without mistaking every mismatch for a problem.

References

No external documentation was required for this workflow.

What would your domain sell for?

A free TidyURLs account unlocks the Domain Estimator. It prices a name from 191,011 real domain sales.