How do I parse a URL into its components?
Paste any URL and instantly see it broken down into protocol, hostname, port, path, query parameters, and fragment. Query parameters are displayed in a searchable table. All parsing happens in your browser using the native URL API.
https://api.example.com:8080/v2/users?page=3&sort=name#results
Protocol: https Host: api.example.com Port: 8080 Path: /v2/users Query: page=3, sort=name Fragment: results
URL Parser
Parse and inspect URL components. View protocol, host, path, query parameters, and hash.
Tips & Best Practices
Use the URL API instead of regex for parsing
JavaScript's built-in URL class handles edge cases that regex misses: IPv6 addresses, IDN domains, percent-encoded characters, port numbers, and protocol-relative URLs. new URL(str) throws on invalid URLs, making it a validator and parser in one.
Query parameters can appear multiple times
The URL ?color=red&color=blue is valid — color has two values. URLSearchParams.get() returns only the first value. Use URLSearchParams.getAll('color') to get all values as an array. Many developers lose data by assuming single-value parameters.
Open redirect vulnerabilities hide in URL parsing
If your app redirects to a URL from a query parameter (?redirect=https://evil.com), an attacker can phish your users. Always validate that redirect URLs are relative paths or belong to an allowlist of trusted domains. Check the parsed hostname, not just string prefix matching.
Fragment identifiers never reach the server
The # portion of a URL (hash/fragment) is client-side only — browsers strip it before sending HTTP requests. This is why single-page apps use hash routing: the server always sees the same URL. It also means you cannot log or track fragment changes server-side.
Frequently Asked Questions
What are the parts of a URL?
How do I extract query parameters from a URL?
What is the difference between encodeURI and encodeURIComponent?
Related Inspect Tools
HTTP Status Codes
Complete HTTP status code reference — 1xx, 2xx, 3xx, 4xx, 5xx with detailed explanations and use cases
Date Format Tester
Test date format patterns for strftime, date-fns, Moment.js, Go, and Java with live preview and token reference
Dockerfile Validator
Validate and lint Dockerfiles for syntax errors, security issues, best practices, and layer optimization
Kubernetes YAML Validator
Validate Kubernetes manifests for syntax, required fields, best practices, security, and resource limits