URL Hostname
Extract the hostname of an absolute URL using the WHATWG URL parser, including its normalization rules.
Description
A hostname names the host without its port.
A hostname names the host without its port. WHATWG parsing normalizes supported host forms, including ASCII serialization of internationalized domains and brackets around IPv6 addresses.1
Extract the hostname of an absolute URL using the WHATWG URL parser, including its normalization rules.
When to use URL Hostname
Use this tool to extract the hostname of an absolute URL using the WHATWG URL parser, including its normalization rules.
Choose the URL, decoded source text, header value or explicit byte list requested by this tool. Paste the complete relevant input and follow its parsing and encoding conventions.
How to use URL Hostname and understand its results
- Choose the URL, decoded source text, header value or explicit byte list requested by this tool. Paste the complete relevant input and follow its parsing and encoding conventions.
- Enter url using the field table and calculation rules, then run the tool.
- Read hostname. The explanation below defines the units, signs, ordering and any flags or placeholder values.
- If the tool reports an input issue, correct the values and run it again. Apply the stated assumptions when interpreting a successfully returned result.
| Input field | Meaning | Value type; see rules below | Requirement |
|---|---|---|---|
| url | Absolute URL to parse. | string; maximum length: 1000000 | Required |
Paste an absolute URL. Return the normalized hostname excluding a port and user information. Hostless schemes can return an empty string. A relative or malformed URL returns an input error.
hostname=WHATWG_URL(url).hostname Units, indexing, boundary conditions and exceptional cases are defined in the calculation rules above.
| Output field | Meaning | Value type |
|---|---|---|
| hostname | Normalized URL hostname. | string; maximum length: 1000000 |
{
"input": {
"url": "https://reader:secret@EXAMPLE.com:8443/a/../guide?q=one&q=two#part"
},
"output": {
"hostname": "example.com"
}
} Limitations and assumptions
The tool does not resolve DNS, confirm registration or determine domain ownership. Host normalization is scheme-dependent and is not a Unicode-confusable safety check.
Numeric inputs must be finite. Follow the calculation-specific rules for overflow, underflow and exceptional cases. Extremely large text inputs are rejected. Missing required fields, extra fields, wrong value types and violations of the calculation rules are input errors.
Alternative or Complementary methods
Use URL Host: Extract the host of an absolute URL using the WHATWG URL parser, including its normalization rules. For a complementary task, use Unicode Domain to ASCII: Normalize a Unicode domain using WHATWG URL IDNA processing and return its ASCII hostname without performing DNS lookup.
References
-
URL Hostname — tool.io
Similar or alternative tools
- URL Host
Extract the host of an absolute URL using the WHATWG URL parser, including its normalization rules.
- Unicode Domain to ASCII
Normalize a Unicode domain using WHATWG URL IDNA processing and return its ASCII hostname without performing DNS lookup.