Published on

🌐 URL vs URI vs URN

Authors

Comparison between URL, URI, and URN

Figure: Visual comparison of URI, URL, and URN. Source:

ByteByteGo

🌐 URL vs URI vs URN

In the world of web technologies, these three terms often come up interchangeably - but they have important differences. Let’s clarify:

πŸ†” URI - Uniform Resource Identifier

A URI is a generic term that identifies a logical or physical resource on the web. Both URL and URN are types of URI.

πŸ’‘ URI Syntax:

scheme:[//authority]path[?query][#fragment]
  • βœ… A URI may contain both a name and a location.
  • βœ… Every URL is a URI, but not every URI is a URL.

🌍 URL - Uniform Resource Locator

A URL is the most common type of URI.

  • πŸ“Œ It locates a resource on the web.
  • 🌐 Used heavily with protocols like http, https, ftp, and even jdbc.
  • πŸ”‘ It's the actual address of a resource.

Example: https://example.com/blog/post?ref=chatgpt


🧾 URN - Uniform Resource Name

A URN is another type of URI that names a resource but doesn't tell you where to find it.

  • 🧱 Uses the urn: scheme.
  • ❌ Cannot be used to locate a resource.
  • 🏷️ Composed of a namespace and a namespace-specific string.

Example: urn:isbn:0451450523


🧭 Summary

TermFull NameFunctionCan Locate Resource?
URIUniform Resource IdentifierGeneric identifier❓ Maybe
URLUniform Resource LocatorLocates the resourceβœ… Yes
URNUniform Resource NameNames the resource❌ No

πŸ”— Source

ByteByteGo - URL vs URI vs URN

πŸ™ Acknowledgments

Special thanks to ChatGPT for enhancing this post with suggestions, formatting, and emojis.