How to Extract Domain from URL

For SEO specialists and marketers, extracting the root domain (e.g., "google.com") from a full URL (e.g., "[https://www.google.com/search?q=](https://www.google.com/search?q=)...") is a daily task.

Why not use LEFT/RIGHT?

Using standard text functions is difficult because URLs vary in length. Some start with HTTP, some with HTTPS, and some have "www".

This tool uses a Regular Expression to ignore the protocol (http://) and the "www" prefix, capturing only the core domain name immediately following them.

Pro Tip

If you need to extract the full path or specific parameters, consider using the SPLIT function with "/" as the delimiter.

Common Errors & Fixes

  • REGEXEXTRACT returns empty or wrong string

    Causes:
    • URL missing or not a string.
    • Pattern does not match internationalized or unusual TLDs.
    • Cell contains only a path with no host.
    Fixes:
    • Ensure the cell has a full URL with a host.
    • Test the pattern in one cell before filling down.
    • For email-based domains use the extract-email tool instead.

Frequently Asked Questions

How do I extract domain from URL in Excel?

Use REGEXEXTRACT with a pattern that strips protocol and path, or this generator’s pattern to return the host (e.g. example.com) from a full URL in a cell.

Does this return subdomain or root domain only?

The default pattern captures the host after optional http(s) and www. For subdomains you get the full host (e.g. blog.example.com). Adjust the regex if you need only the registrable domain.

Want to become an Excel Pro?

Stop searching for formulas. Master Excel in 30 days with this top-rated course.

Learn More