Skip to content

URL Encode / Decode

Encode or decode text with encodeURIComponent / decodeURIComponent style rules.

Maintained by the Calcenzo team. Last reviewed September 27, 2026. Methodology

URL Encode / Decode

A URL encode decode tool converts text to and from percent-encoding, the format used to put special characters in web addresses. Formula: Encode: encodeURIComponent(text). Decode: decodeURIComponent(text). “hello world” encodes to hello%20world.

url encode decode
Url encode decode chart: percent-encoding examples.

How to use the url encode decode

  1. Paste the text or encoded string.
  2. Choose encode or decode.
  3. Copy the result.

How the URL encode decode tool works

This URL encode decode tool uses the browser’s encodeURIComponent and decodeURIComponent functions. Encoding turns every character that is not an unreserved character into percent-encoded UTF-8 bytes, such as a space into %20. Decoding reverses the process. Unreserved characters, which stay as they are, are letters, digits and – _ . ! ~ * ’ ( ).

URL encode decode worked example

Encoding “hello world & more” gives hello%20world%20%26%20more: each space becomes %20 and the ampersand becomes %26. The letter é is two bytes in UTF-8, so it becomes %C3%A9. Paste the encoded text back with decode mode and you get the original.

Text Encoded
hello world & more hello%20world%20%26%20more
café caf%C3%A9
a+b=c a%2Bb%3Dc
50% off 50%25%20off
path/to?x=1 path%2Fto%3Fx%3D1

Why URLs need encoding

RFC 3986 defines which characters may appear in a URI. Reserved characters such as ? & = / and # separate parts of a URL, so data that contains them must be percent-encoded to avoid changing the meaning. A search for “a+b=c” must be sent as a%2Bb%3Dc, or the server will read the equals sign as a separator.

Encoding a component, not a whole URL

encodeURIComponent is designed for one piece of a URL, such as a query value or a path segment. It encodes slashes, question marks and colons too, so running a full address like https://example.com/a?b=1 through it breaks the address. Encode each value separately and then join them with the separators.

Spaces, plus signs and forms

HTML forms sent as application/x-www-form-urlencoded write spaces as + instead of %20. This tool always produces %20 and, when decoding, leaves + as a plus sign. If you decode form data, replace + with a space first.

Decoding errors

In the URL encode decode tool, decoding fails when a percent sign is not followed by two hex digits, as in “50% off”, or when the bytes are not valid UTF-8. The tool then shows an error rather than a garbled result. Encode the text first if it contains a literal percent sign; % becomes %25.

Where URL encoding is used

Developers use URL encoding when building query strings in code, creating links with tracking parameters, and sending data in GET requests. Email links that use mailto: with a subject and body need encoding so spaces and line breaks survive. Redirect parameters often contain a full URL as their value, so that inner URL must be encoded to keep its own question mark and ampersands from being read as part of the outer address.

Most programming languages have built-in functions. In JavaScript, encodeURIComponent is the right choice for values. In Python, urllib.parse.quote does a similar job, with a safe parameter for characters to leave alone. PHP has rawurlencode, which matches RFC 3986, and urlencode, which uses plus signs for spaces like HTML forms. Results from this URL encode decode tool match encodeURIComponent exactly.

Encoding and security

Percent-encoding is not encryption. Anyone can decode it, so never rely on it to hide passwords or tokens in a link. It also does not by itself prevent cross-site scripting: data inserted into HTML must be escaped for HTML, and data in SQL must use parameterized queries. Encode for the context where the data ends up.

Strings from a URL encode decode tool can look alarming in logs and browser address bars, but they are normal. Most browsers show decoded characters in the address bar while sending the encoded form to the server. Pasting a link from the address bar into a document may copy either version, depending on the browser and settings.

Tips

  • Encode each query value, not the whole URL.
  • Do not encode text twice; %20 would become %2520.
  • Use UTF-8 everywhere.
  • Base64 is a different encoding, used for binary data.

Related calculators:

Sources

IETF RFC 3986: Uniform Resource Identifier (URI) generic syntax.

Formula and method

Encode: encodeURIComponent(text). Decode: decodeURIComponent(text).

Uses the browser JavaScript URI component encode/decode functions registered for this tool.

Questions about this calculator

What does %20 mean?

A space.

Which function does it use?

encodeURIComponent and decodeURIComponent.

Should I encode a whole URL?

No, encode each component.

Why does decoding fail?

A stray % or invalid UTF-8 bytes.

How are plus signs handled?

They are left as plus signs when decoding.

Check the assumptions and units before relying on a result. Financial, tax and health estimates do not replace advice for your individual circumstances.

Report a calculation issue