Skip to content
🛠️ToolsShed

URL Diff Checker

Compare two URLs and highlight differences in each component.

About this tool

The URL Diff Checker is a practical tool for comparing two URLs side-by-side and instantly spotting what has changed. Whether you're debugging a redirect chain, reviewing URL migrations, or verifying that tracking parameters were applied correctly, this tool breaks down each URL into its core components—scheme, host, port, path, query string, and fragment—and highlights exactly where they differ. It's especially useful when you need to understand how a URL evolved across different stages of a system or between development and production environments.

Simply paste your two URLs into the input fields and click Compare. The tool displays a detailed table showing each component of both URLs alongside a status indicator: green highlights components that exist only in the first URL, red highlights those only in the second, yellow shows differences, and gray indicates identical parts. Below the main components, a separate section lists all query parameters found in either URL, making it easy to spot added, removed, or changed parameters at a glance.

Frequently Asked Questions

Code Implementation

from urllib.parse import urlparse, parse_qs

def parse_url_components(url: str) -> dict:
    p = urlparse(url)
    return {
        "scheme":   p.scheme,
        "host":     p.netloc,
        "path":     p.path,
        "query":    parse_qs(p.query),
        "fragment": p.fragment,
    }

def url_diff(url1: str, url2: str) -> dict:
    a = parse_url_components(url1)
    b = parse_url_components(url2)
    diff = {}
    for key in a:
        if a[key] != b[key]:
            diff[key] = {"from": a[key], "to": b[key]}
    return diff

url_a = "https://example.com/search?q=hello&page=1#results"
url_b = "https://example.com/search?q=world&page=2#top"

differences = url_diff(url_a, url_b)
if differences:
    print("Differences found:")
    for component, change in differences.items():
        print(f"  {component}:")
        print(f"    from: {change['from']}")
        print(f"    to:   {change['to']}")
else:
    print("URLs are identical")

Comments & Feedback

Comments are powered by Giscus. Sign in with GitHub to leave a comment.