FREE BROWSER TOOL

Trim URLs to their domains.

Turn full URLs into hostnames. This tool removes the protocol, path, query string, and a leading www. while keeping subdomains.

Paste one full http or https URL per line.

Domains

Paths, query strings, protocol, and a leading www. are removed.

How to use this tool

  1. Paste complete URLs

    Enter one absolute HTTP or HTTPS address per line. Include the protocol; entries that are not valid web URLs are counted as invalid and skipped.

  2. Extract hostnames

    Select Trim to domain. The tool removes the protocol, path, query, fragment, port, and a leading www. from each valid hostname.

  3. Copy or compare the list

    Review the input, domain, and invalid counts, then copy the resulting hostnames. Duplicate domains are retained so each valid input still has a corresponding output.

Domain, hostname, and root URL are different

This tool returns the URL hostname. For https://www.example.com/products/item?id=5, the output is example.com. It removes one leading www. prefix, but preserves other subdomains: https://blog.example.com/article becomes blog.example.com.

The result is not a registrable root domain. For example, shop.example.co.uk remains shop.example.co.uk; the tool does not determine the public-suffix boundary or reduce it to example.co.uk. It also removes the port number, which can matter when a site uses a nonstandard port.

When to trim URLs to domains

Hostname lists are useful for grouping a URL export by site, preparing a domain-level review, or comparing which hosts appear in a collection. If you need page paths, query parameters, or exact origins for redirect testing, keep the original URLs instead.

Input is parsed and transformed in your browser. Invalid lines are skipped and included in the invalid count, while valid duplicate hostnames are preserved in their original order.

Frequently asked questions

Does this return the root or registrable domain?

No. It returns the hostname after removing a leading www. Prefix. Other subdomains are preserved, and the tool does not calculate registrable domains such as example.co.uk.

Are subdomains removed?

No. A hostname such as blog.example.com remains blog.example.com. Only a leading www. prefix is stripped.

What happens to the path and query string?

They are removed because the output is only the hostname. The protocol, port, path, query, and fragment are not included.

Why is my URL counted as invalid?

Each line must parse as a complete HTTP or HTTPS URL, including its scheme. Add https:// or http:// before the host; unsupported schemes and incomplete addresses are skipped.