URL parser and validator

Break a URL into scheme, host, port, path, query and fragment, and see why an invalid one is invalid. Handles IDN hosts, repeated parameters and odd schemes.

Every component, including the ones that are easy to miss

Scheme, credentials, host, port, path, query and fragment — plus the details that usually get lost: whether the fragment is absent or present-but-empty, whether the port is written or implied, and whether the host is internationalized.

Why an invalid URL is invalid

The browser's own parser throws a single TypeError: Invalid URL for every failure, which tells you nothing. The three that account for almost everything:

  • No scheme. example.com/x is not a URL, it is a string that looks like one. Tick the assume-https box and it becomes one.
  • A space. Usually a line wrap in whatever you copied from. Spaces must be %20.
  • An unencoded character in the host. Hosts have a much narrower character set than paths, and an underscore or an accent that is fine in a path is fatal in a hostname.

Credentials in a URL

https://user:pass@example.com is still valid syntax, and still a bad idea: the whole URL lands in server logs, browser history, and the referrer header of every outbound link on the page. If this tool shows a password field, treat that credential as compromised.

Occasional email

New tools, when there are new tools

No more than once a month, no tracking pixels in the mail, one-click unsubscribe.