How to extract domain names from text
How to extract domain names
- Paste content into Input text, or select Upload and choose a supported file.
- Set Unique only, Lowercase (normalize case), Strip www prefix, and Keep subdomains.
- Review Extracted hosts, including each Host, Line, and Context entry.
- Select Copy or Download to take the list with you.
Extract hostnames from URLs and HTML
The parser scans ordinary sentences, URL lists, and raw HTML source for hostname-shaped text. It keeps the host and drops the protocol, path, query string, and fragment. HTML is read as text, so tags are not parsed or checked as a document.
Input: https://www.Example.com/products?ref=42
http://blog.EXAMPLE.com/post/1#intro
Output: example.com
blog.example.com
A match must end with a final label in the built-in KNOWN_TLDS set. Labels may contain ASCII letters or numbers, with hyphens inside a label. A valid hostname with an unlisted or newer suffix can be left out. The result is a text match, so the tool does not check DNS or ownership.
What the domain extraction options change
- Unique only keeps the first formatted occurrence in input order. Clear it to keep repeats. The tool deduplicates after applying the other selected options.
- Lowercase (normalize case) converts the returned host to lowercase.
- Strip www prefix removes a leading
www.. - Keep subdomains retains labels such as
mail.. Clear it to reduce the hostname with the built-in suffix rules.
Input: https://sub.domain.co.uk/path
Keep subdomains: on sub.domain.co.uk
Keep subdomains: off domain.co.uk
Review and download extracted domain names
Upload accepts .txt, .csv, .json, .log, .html, and .htm. The result count reports the formatted hosts that remain. Output text puts one host on each line, and the table shows Host, Line, and Context.
Copy places the output list on your clipboard. Download saves it as domains.txt. The extraction script processes entered text in the browser and contains no request that submits it elsewhere.
Where extracting hostnames comes up
Paste HTML source when you need the hosts appearing in a page draft. For a log excerpt, the table places each retained host beside its source line and context.
When you need the full links, use Extract URLs from Text. For addresses, choose Extract Emails from Text; for a pattern that does not match hostname rules, use Custom Regex Extractor. These tools sit in Text Parsing & Data Extraction.
Frequently asked questions
How do I extract domain names from a URL list?
Paste the URL list into Input text, set the four options, and read the hosts in Output text and Extracted hosts. Each URL contributes its host without its path, query string, or fragment.
Can I extract hostnames from HTML source?
Paste the raw HTML into Input text. The parser scans it as text for hostname-shaped matches and does not parse or check the HTML document.
What does Keep subdomains do when extracting domain names?
Keep subdomains preserves labels such as blog. in blog.example.com. Clear it to apply the built-in suffix rules, which include two-label suffixes such as co.uk and com.au.
Why did Extract Domain Names find no hosts?
No hosts found means no match passed the hostname pattern and built-in final-label check. Output text remains empty, and the results table stays hidden.
Does Extract Domain Names send pasted text to a server?
The extraction script processes entered text in the browser. Its local code contains no request that submits the text.