URL Hash
Extract the hash of an absolute URL using the WHATWG URL parser, including its normalization rules.
Description
A fragment identifies a part or client-side state of a resource after a hash.
A fragment identifies a part or client-side state of a resource after a hash. The hash property serializes that fragment and does not reveal whether an empty delimiter appeared in the original text.1
Extract the hash of an absolute URL using the WHATWG URL parser, including its normalization rules.
When to use URL Hash
Use this tool to extract the hash 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 Hash 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 hash. 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 fragment including its leading hash when nonempty. An absent fragment and a trailing empty hash both produce an empty string. Encoded %23 inside a path is not a fragment separator.
hash=WHATWG_URL(url).hash Units, indexing, boundary conditions and exceptional cases are defined in the calculation rules above.
| Output field | Meaning | Value type |
|---|---|---|
| hash | Normalized URL hash. | string; maximum length: 1000000 |
{
"input": {
"url": "https://reader:secret@EXAMPLE.com:8443/a/../guide?q=one&q=two#part"
},
"output": {
"hash": "#part"
}
} Limitations and assumptions
This does not decode fragment content or validate application-specific anchors. An empty hash property cannot by itself prove there was no fragment delimiter, which matters for WebSocket URL validation.
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 Pathname: Extract the pathname of an absolute URL using the WHATWG URL parser, including its normalization rules. For a complementary task, use WebSocket URL Validator: Check an absolute ws, wss, http, or https URL against WebSocket constructor URL rules, excluding fragments. HTTP schemes are accepted by the constructor and mapped to WebSocket schemes.
References
-
URL Hash — tool.io
Similar or alternative tools
- URL Pathname
Extract the pathname of an absolute URL using the WHATWG URL parser, including its normalization rules.
- WebSocket URL Validator
Check an absolute ws, wss, http, or https URL against WebSocket constructor URL rules, excluding fragments. HTTP schemes are accepted by the constructor and mapped to WebSocket schemes.