What is a URL?

A URL (uniform resource locator) is the address of a page or file on the web, the text in your browser's address bar. A full one, such as https://www.example.com:8080/garden/tips?season=spring#roses, has a protocol (https), then :// and a host name, an optional port after a colon, a path, a query string after ? and a fragment after #.

You check URLs when you build a form with a website field, or when you clean up a list of links before you share it.

Tool description

Type or paste a link into the URL field, and the result shows as you type: "URL is valid" or "URL is not valid". Spaces and line breaks around a pasted URL are ignored.

Allowed protocols lists the protocols a URL may start with, separated by commas or spaces, and starts on http, https, ftp: add ws, wss for WebSocket addresses, or keep only https. The list only matters for URLs that have a protocol, so tick Require a protocol (off at the start) to make example.com fail too.

Require a top-level domain is on at the start, so the host name has to end in one, such as .com. Turn it off for names such as localhost, and then a single word such as printer passes too. Allow underscores (off) accepts underscores in the host name, as in my_site.example.com. Reject a user name and password (off) makes URLs with login details before the host fail, as in https://user:password@example.com.

What the defaults let through

  • Links with or without a protocol: https://example.com, www.example.com, example.com/menu
  • A port from 1 to 65535: example.com:8080
  • IPv4 addresses, and IPv6 addresses in square brackets: http://192.0.2.10:8080, http://[2001:db8::1]/
  • Domain names with accented or non-Latin letters, such as https://café.example.com
  • Paths, query strings and fragments: https://example.com/recipes/pie?size=large#steps

What fails with the defaults

  • Host names without a top-level domain: http://localhost:3000 fails, while an IP address in its place passes
  • Other protocols, such as ws:// or file://, links that start with //, and mailto: links even when you add mailto to the list
  • Spaces, < or > anywhere in the URL
  • Port 0 and ports above 65535
  • Underscores in the host name, a dot at its end (example.com.) and a top-level domain of one letter or only digits
  • Extremely long URLs

Good to know

  • The check doesn't open the link, so it can't tell whether the page exists or is safe.
  • In the path and the query string, characters a link should encode, such as " or {, pass.
  • In https://example.com@example.net, the part before the @ is a user name, so the link passes and leads to example.net. javascript:alert@example.com passes the same way, although browsers read it as a javascript: link. Tick Reject a user name and password to make both fail.
  • To see a link's parts one by one, use the URL parser.

Features

  • Checks web addresses with or without a protocol
  • Choose which protocols to accept
  • Settings for local host names, underscores and login details
  • Accepts IP addresses, ports and international domain names
  • Runs in your browser, so nothing you type is sent anywhere