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

  1. 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.
  2. Enter url using the field table and calculation rules, then run the tool.
  3. Read hash. The explanation below defines the units, signs, ordering and any flags or placeholder values.
  4. 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 fieldMeaningValue type; see rules belowRequirement
urlAbsolute URL to parse.string; maximum length: 1000000Required

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 fieldMeaningValue type
hashNormalized URL hash.string; maximum length: 1000000
json
{
  "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

  1. 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.

Don't forget to set a bookmark for tool.io!
Privacy | Imprint | Cookies