URL Host
Extract the host of an absolute URL using the WHATWG URL parser, including its normalization rules.
Description
The host component combines hostname with a nondefault port.
The host component combines hostname with a nondefault port. Keeping that distinction clear prevents treating a host-and-port string as a bare DNS name.1
Extract the host of an absolute URL using the WHATWG URL parser, including its normalization rules.
When to use URL Host
Use this tool to extract the host 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 Host 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 host. 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 |
Provide an absolute URL. Return its normalized host, including an explicit nondefault port and IPv6 brackets where applicable. Scheme-default ports are omitted; a hostless URL can produce an empty string.
host=WHATWG_URL(url).host Units, indexing, boundary conditions and exceptional cases are defined in the calculation rules above.
| Output field | Meaning | Value type |
|---|---|---|
| host | Normalized URL host. | string; maximum length: 1000000 |
{
"input": {
"url": "https://reader:secret@EXAMPLE.com:8443/a/../guide?q=one&q=two#part"
},
"output": {
"host": "example.com:8443"
}
} Limitations and assumptions
No DNS lookup or listening-service check is performed. User information, path and origin scheme are excluded, so the result alone is not a complete endpoint URL.
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 Hostname: Extract the hostname of an absolute URL using the WHATWG URL parser, including its normalization rules. For a complementary task, use URL Port: Extract the port of an absolute URL using the WHATWG URL parser, including its normalization rules.
References
-
URL Host — tool.io
Similar or alternative tools
- URL Hostname
Extract the hostname of an absolute URL using the WHATWG URL parser, including its normalization rules.
- URL Port
Extract the port of an absolute URL using the WHATWG URL parser, including its normalization rules.