URL Encoder / Decoder

Encode or decode URLs and special characters instantly.

URLs have strict rules about which characters are allowed. Spaces, ampersands, question marks, and non-ASCII characters must be percent-encoded to pass safely through browsers, servers, and APIs. This tool encodes and decodes URL components instantly, helping you debug query strings, build API requests, and troubleshoot broken links.

How to Encode and Decode URLs

  1. Encode a full URL — paste a complete URL and click "Encode URL" to make it safe for transport while preserving URL structure characters (/, ?, =, &).
  2. Encode a URL component — use "Encode Component" for a single value like a query parameter that may contain /, ?, = or & that need escaping.
  3. Decode a URL — paste a percent-encoded string (e.g. hello%20world) and click "Decode URL" to get back the original text.
  4. Copy the result — click Copy to copy the output.

Worked Example: Encoding a URL Inside a Query Parameter

The classic mistake: passing a URL as a query parameter without encoding it. Say you want to redirect to https://example.com/page?id=42&lang=en after login:

Wrong (raw URL in the parameter):

https://myapp.com/login?next=https://example.com/page?id=42&lang=en

The server sees lang=en as a parameter of myapp.com, not of the redirect target — the redirect breaks.

Right (encode the component first):

https://myapp.com/login?next=https%3A%2F%2Fexample.com%2Fpage%3Fid%3D42%26lang%3Den

Use Encode Component for the inner URL (it escapes / ? = &), and Encode URL only when encoding a full URL whose structure must stay intact.

URL Encoding Reference Table

The characters most often encoded, per RFC 3986:

CharacterEncodedCharacterEncoded
space%20/%2F
!%21:%3A
"%22;%3B
#%23=%3D
$%24?%3F
%%25@%40
&%26[%5B
'%27]%5D
+%2B,%2C

Never encoded (unreserved): A–Z a–z 0–9 - _ . ~

Frequently Asked Questions

What is URL encoding (percent-encoding)? ▼
URL encoding replaces unsafe or reserved characters with a % followed by two hexadecimal digits. For example, a space becomes %20, & becomes %26, and # becomes %23. This ensures URLs are safely transmitted over the internet without misinterpretation.
What is the difference between encodeURI and encodeURIComponent? ▼
encodeURI encodes a full URL, leaving structural characters (/, ?, =, &, :, #) untouched because they have meaning within a URL. encodeURIComponent encodes a single component value (like a query string parameter) and encodes ALL special characters including /, ?, =, and &.
When should I encode a URL? ▼
Encode URLs when: passing a URL as a query parameter value, embedding special characters in URL paths, building API requests, or ensuring compatibility with HTTP clients that reject unencoded characters.
What does %20 mean in a URL? ▼
%20 is the URL-encoded representation of a space character. URLs cannot contain literal spaces, so they are replaced with %20. In HTML form submissions, spaces may instead appear as + in the query string.
What characters are safe in URLs? ▼
The following characters are always safe and do not need encoding: alphanumeric characters (A–Z, a–z, 0–9), and the special characters - _ . ~ (unreserved characters per RFC 3986). All other characters should be percent-encoded for maximum compatibility.