# URL Parser — Language Guides, Use-Case Guides, Definitions For the full tool, see: [https://capytoolkit.com/tools/network/url-parser/](https://capytoolkit.com/tools/network/url-parser/) ## URL Parser: Code Examples [URL Parsing in JavaScript](https://capytoolkit.com/tools/network/url-parser/code-examples/#url-parsing-javascript): Parse URLs in JavaScript using the URL constructor, URLSearchParams, and string methods. Extract pathname, query, hash, and origin with examples. [URL Parsing in Python](https://capytoolkit.com/tools/network/url-parser/code-examples/#url-parsing-python): Parse and manipulate URLs in Python using urllib.parse. Split URLs into components, handle query strings, and reconstruct URLs with urlparse and urlunparse. [URL Parsing in Go](https://capytoolkit.com/tools/network/url-parser/code-examples/#url-parsing-go): Parse and build URLs in Go using the net/url package. Parse URL strings, query parameters, path escaping, and reconstruct URLs with url.URL. [URL Structure — RFC 3986](https://capytoolkit.com/tools/network/url-parser/code-examples/#url-structure-rfc-3986): Understand the anatomy of a URL: scheme, authority, path, query, fragment, and percent-encoding rules defined in RFC 3986. [URL Parsing in PHP](https://capytoolkit.com/tools/network/url-parser/code-examples/#url-parsing-php): Parse URLs in PHP with parse_url(), extract query parameters with parse_str(), and rebuild query strings with http_build_query(). Full examples and edge cases. [URL Parsing in Ruby](https://capytoolkit.com/tools/network/url-parser/code-examples/#url-parsing-ruby): Parse URLs in Ruby using the built-in URI module and the Addressable gem. Extract components, handle query strings, and work with relative URLs. [URL Parsing in Rust](https://capytoolkit.com/tools/network/url-parser/code-examples/#url-parsing-rust): Parse and manipulate URLs in Rust using the url crate. Access components, iterate query pairs, and build URLs safely with Url::parse(). [URL Parsing in Java](https://capytoolkit.com/tools/network/url-parser/code-examples/#url-parsing-java): Parse and build URLs in Java using java.net.URI and OkHttp HttpUrl. Access scheme, host, path, and query parameters with practical examples and gotchas. [URL Parsing in C#](https://capytoolkit.com/tools/network/url-parser/code-examples/#url-parsing-csharp): Parse URLs in C# with System.Uri, build and modify them with UriBuilder, and read query parameters with QueryHelpers from ASP.NET Core. [URL Parsing in Swift](https://capytoolkit.com/tools/network/url-parser/code-examples/#url-parsing-swift): Parse and build URLs in Swift using URLComponents and URLQueryItem. Access scheme, host, path, and query parameters with safe, type-checked Foundation APIs. [URL Parsing in Kotlin](https://capytoolkit.com/tools/network/url-parser/code-examples/#url-parsing-kotlin): Parse URLs in Kotlin using java.net.URI, Ktor's Url class, and extension functions. Access components, build query strings, and handle encoding with idiomatic Kotlin APIs. [URL Parsing in Bash](https://capytoolkit.com/tools/network/url-parser/code-examples/#url-parsing-bash): Parse URLs in Bash using grep, sed, awk, and parameter expansion. Extract scheme, host, path, and query strings from shell scripts without external dependencies. [URL Parsing in Node.js](https://capytoolkit.com/tools/network/url-parser/code-examples/#url-parsing-node-js): Parse URLs in Node.js using the WHATWG URL class and URLSearchParams. Compare the modern node:url API with the legacy url.parse() module, with full examples. [Python urllib.parse Reference](https://capytoolkit.com/tools/network/url-parser/code-examples/#urllib-parse-python): Complete reference for Python's urllib.parse module: urlparse, parse_qs, urlencode, urljoin, quote, unquote, urlsplit, and more with practical examples. ## Guides [Extracting Query Parameters from a URL](https://capytoolkit.com/tools/network/url-parser/parse-url-query-string/): Parse URL query strings in JavaScript, Python, Go, and PHP. Extract, read, and modify individual query parameters correctly, including encoded values and repeated keys. [How to Validate URLs in Code](https://capytoolkit.com/tools/network/url-parser/url-validation-guide/): Validate URLs in JavaScript, Python, Go, and PHP. Learn which validation approaches handle schemes, hostnames, paths, and encoded characters correctly. [Parsing and Validating OAuth Redirect URIs](https://capytoolkit.com/tools/network/url-parser/oauth-redirect-uri/): Parse and validate OAuth 2.0 redirect URIs. Understand exact-match rules, fragment restrictions, and common implementation mistakes in authorization code flows. [Extracting UTM Parameters from URLs](https://capytoolkit.com/tools/network/url-parser/utm-parameter-tracking/): Parse UTM parameters (utm_source, utm_medium, utm_campaign) from URLs in JavaScript and Python. Read, validate, and forward tracking parameters correctly. [Designing REST API URLs: Paths, Params, and Versions](https://capytoolkit.com/tools/network/url-parser/api-endpoint-url-design/): Design clean, consistent REST API URLs. Best practices for path structure, query parameters, versioning, and encoding in HTTP API design. [URL Canonicalization and Normalization](https://capytoolkit.com/tools/network/url-parser/url-canonicalization/): Understand URL canonicalization: normalizing schemes, hosts, paths, and query strings to produce a single canonical form for caching, deduplication, and SEO. [Resolving Relative URLs Against a Base URL](https://capytoolkit.com/tools/network/url-parser/relative-url-resolution/): Resolve relative URLs correctly in JavaScript, Python, and Go. Understand the RFC 3986 algorithm for resolving path-relative, root-relative, and protocol-relative references. [Percent-Encoding URLs: When and How](https://capytoolkit.com/tools/network/url-parser/url-encoding-guide/): Understand percent-encoding (URL encoding) in HTTP. Learn which characters to encode, the difference between query encoding and path encoding, and common mistakes. [Tracing Short URLs and Redirect Chains](https://capytoolkit.com/tools/network/url-parser/url-shortener-tracking/): Follow URL shorteners and redirect chains programmatically. Resolve bit.ly, t.co, and custom redirects to their final destinations in JavaScript, Python, and curl. [Securing URLs: SSRF, Open Redirects, and Validation](https://capytoolkit.com/tools/network/url-parser/url-security-best-practices/): Prevent SSRF, open redirects, and URL injection in web applications. Validate URLs correctly to block attacks using percent-encoding, IP ranges, and scheme abuse. ## URL Parser Reference [What Is a Query String?](https://capytoolkit.com/tools/network/url-parser/reference/#what-is-a-query-string): A query string is the part of a URL after the ? character containing key=value pairs. Learn its structure, encoding rules, and how servers and clients use it. [What Is a URL Scheme?](https://capytoolkit.com/tools/network/url-parser/reference/#what-is-a-url-scheme): A URL scheme identifies the protocol or access method for a resource. Learn about http, https, ftp, mailto, file, and custom URI schemes with examples. [What Is Percent-Encoding?](https://capytoolkit.com/tools/network/url-parser/reference/#what-is-percent-encoding): Percent-encoding (URL encoding) converts characters to %XX hex sequences for safe URL transmission. Learn the rules, context-specific encoding, and common mistakes. [What Is a URL Fragment?](https://capytoolkit.com/tools/network/url-parser/reference/#what-is-a-url-fragment): A URL fragment identifies a secondary resource within a page. Learn how the # identifier works, why it is never sent to the server, and how SPAs use it for routing. [What Is URL Authority?](https://capytoolkit.com/tools/network/url-parser/reference/#what-is-url-authority): URL authority is the host and optional port component of a URL. Learn about the authority structure including userinfo, host, and port, and how parsers expose them.