DoItAl

Practical guide

Encode a Destination URL Inside a Query Parameter

Build a return link without letting the destination URL's question mark or ampersand become outer query separators.

Prepared by DoItAl · Worked examples checked . How examples are checked and corrected

The job: keep one URL inside one value

Suppose a help page must pass a destination to an outer /continue page. The invented destination below contains its own query string. If you paste it after next= without encoding, the ampersand before lang becomes a separator in the outer URL. The receiving page may see lang as its own parameter instead of part of next.

Choose the destination URL as the component to encode. Do not encode the outer URL or its structural separators.

https://example.org/docs?topic=tea&lang=en

Encode and assemble the link

Paste the destination into URL component or absolute URL and press Encode component. Copy the complete output, then append it after next= in the outer URL. The tool converts the colon, slashes, question mark, equals sign and ampersand because they are data inside this one parameter value.

The full link in the third row is assembled for this example; the tool does not create a link to visit or validate a receiving service.

Checked browser engine result for the synthetic destination
StageText
Destinationhttps://example.org/docs?topic=tea&lang=en
Encoded next valuehttps%3A%2F%2Fexample.org%2Fdocs%3Ftopic%3Dtea%26lang%3Den
Outer linkhttps://shop.example/continue?next=https%3A%2F%2Fexample.org%2Fdocs%3Ftopic%3Dtea%26lang%3Den

Inspect before sharing

Paste the assembled outer link and press Inspect full URL. The query report should show exactly one pair: next equals the original destination URL. Inspecting parses the string in your browser; it does not request either site. A successful parse does not prove that the outer site's redirect policy accepts the destination.

When decoding a raw query value copied from a form, use Decode + as space only if that value uses form/query encoding. Without the option, a literal plus stays a plus. A %2B escape always means a literal plus in either mode.

Limits and the next handoff

Component conversion has a 100,000-code-unit input limit; full URL inspection has a 10,000-character and 200-query-pair limit. Malformed percent escapes and invalid UTF-8 fail instead of producing a guessed value. URL encoding does not make an untrusted redirect safe: check the receiving site's allowlist and avoid placing secrets in URLs, which can appear in browser history and server logs.

Once the final link is reviewed, QR Code Generator can turn it into a scannable code. Its code contains the complete link, so do not use it for a private token. For an API that expects a JSON body instead of a query string, validate that body with JSON Formatter; URL component encoding is a different job.

Material update: