---
title: "URL Parser"
description: "Breaks a URL into its components and query parameters"
url: https://sade.dev/en/tools/url-parser/
lang: en
author: "Muhammet Şafak"
published: 2026-04-07
updated: 2026-08-30
section: Tool
tags: ["url","http"]
---

# URL Parser

> Breaks a URL into its components and query parameters

The WHATWG URL standard splits a URL into eight components: scheme, username,
password, host, port, path, query, fragment. This tool uses JavaScript's
built-in `URL` class, which implements that standard — the fields below use its
property names (`protocol`, `pathname`, `hash`, …), add the derived `origin` and
`hostname`, and break the query string out into a separate parameter table.

## WHATWG vs RFC 3986

It helps to know the two main specs:

- **RFC 3986** — older, stricter. The IETF's generic URI syntax.
- **WHATWG URL Living Standard** — modern, what browsers use. More forgiving.

Some URLs parse differently between the two specs. For example: should
`http://example.com` get a trailing `/`? (WHATWG: yes, RFC 3986: not required).

This tool uses the WHATWG version — the interpretation modern browsers use.

## Common sources of bugs

- **`URLSearchParams`** always returns values as **strings**. Reading `?count=5`
  means you have to do `Number(searchParams.get('count'))`.
- **Repeated parameters**: for `?tag=a&tag=b`, `searchParams.get('tag')` returns
  only the first value. `searchParams.getAll('tag')` returns both.
- **Percent encoding**: `%20` is a space, while `+` means a space only in the
  query string. In the pathname, `+` is a raw character.
- **IDN (internationalized domains)**: parsing `münir.com` normalizes it to
  `xn--mnir-0ra.com` (punycode).

## Pathname trailing slash

Do `/users` and `/users/` represent the same resource? In practice:

- REST APIs usually don't distinguish them.
- Static file servers may distinguish them (`/users` redirects to `/users/`,
  which serves the index).
- For SEO, pick one canonical form and redirect from the other.

## Privacy

The URL you paste is processed entirely in your browser.
