Uses libcurl's URL parser so curl and trurl always agree on URL interpretation. Can extract, set, append, and replace individual URL components. Supports JSON output and batch processing from files.
Notes
Created by Daniel Stenberg (curl author). Requires libcurl. Can sort query params, encode/decode URLs, redirect, and verify URL validity.
Version
Latest known: 0.16.1 (2025-05-12)
Try it
Parse a URL into JSON
Pass a complex URL (scheme, userinfo, host, port, path, query, fragment) to trurl with --json so libcurl's URL parser breaks every component out. The JSON shape includes the parts struct and the query list, with each query parameter as its own object. trurl uses the same parser as curl, so the interpretation is guaranteed to match what curl will see.
Modify URL components (--set)
Use --set <component>=<data> to rewrite specific URL components in place. The demo takes a URL and sets a new port and path, leaving everything else (scheme, host, query, fragment) untouched. Multiple --set flags can be chained. Components understood by trurl: url, scheme, user, password, options, host, port, path, query, fragment, zoneid.
Sort and trim query parameters
Combine --sort-query (alphabetically sort query pairs by key) and --qtrim <pattern> (remove pairs whose key matches the pattern) to canonicalize a URL's query string. Useful for cache-key normalization where '?z=1&a=2' and '?a=2&z=1' should be treated as the same URL.
# trurl - Help
Source: https://curl.se/trurl/
```
Usage: trurl [options] [URL]
-a, --append [component]=[data] - append data to component
--accept-space - give in to this URL abuse
--as-idn - encode hostnames in idn
--curl - only schemes supported by libcurl
--default-port - add known default ports
-f, --url-file [file/-] - read URLs from file or stdin
-g, --get [{component}s] - output component(s)
-h, --help - this help
--iterate [component]=[list] - create multiple URL outputs
--json - output URL as JSON
--keep-port - keep known default ports
--no-guess-scheme - require scheme in URLs
--punycode - encode hostnames in punycode
--qtrim [what] - trim the query
--query-separator [letter] - if something else than '&'
--quiet - Suppress (some) notes and comments
--redirect [URL] - redirect to this
--replace [data] - replaces a query [data]
--replace-append [data] - appends a new query if not found
-s, --set [component]=[data] - set component content
--sort-query - alpha-sort the query pairs
--url [URL] - URL to work with
--urlencode - show components URL encoded
-v, --version - show version
--verify - return error on (first) bad URL
URL COMPONENTS:
url, scheme, user, password, options, host, port, path, query, fragment, zoneid
```