URL Encoding Explained With Practical Examples

Understand percent encoding for query strings, redirect URLs and API parameters, with examples developers actually encounter.

By Lumarc Studio · Updated 2026-07-29

URL encoding, also called percent encoding, represents characters in a form that can safely appear inside URLs.

Spaces, ampersands, question marks and non-ASCII characters can have special meaning in a URL. Encoding a value prevents it from being mistaken for URL structure.

json formatter & validator

becomes:

json%20formatter%20%26%20validator

Encode Components, Not Always Whole URLs

Most developer bugs happen when the wrong part of the URL is encoded. If you are building a query string, encode the value:

const value = encodeURIComponent("json formatter & validator");
const url = `/search?q=${value}`;

Encoding an entire URL with component rules can also encode https://, slashes and query separators, which may not be what you want.

Decoding for Debugging

The URL Decoder helps inspect copied links, webhook URLs and redirect parameters. The URL Encoder helps prepare safe query values locally in your browser.

Unicode and URLs

Modern URLs can contain Unicode, but many systems still encode those characters when sending requests. If you are debugging escaped JavaScript strings as well, the Unicode Escape and Unescape tool is a better fit.

Related tools

Related guides