Data Tools

URL Encode and Decode Online Free

URLs can only contain a limited set of characters. When you need to include spaces, special symbols, or non-ASCII text in a URL, those characters must be percent-encoded. This guide explains URL encoding and shows you how to encode or decode any string online in seconds.

What Is URL Encoding?

URL encoding (also called percent-encoding) is a mechanism for converting characters that are not safe to use in a URL into a format that can be transmitted safely over the internet. The URL specification (RFC 3986) defines a limited set of characters as "unreserved" β€” letters A–Z, digits 0–9, and the symbols -, _, ., and ~. Every other character must be percent-encoded before it can appear in a URL.

You've seen percent-encoding in action without knowing it. The %20 in a URL stands for a space character. The %40 stands for the @ symbol. When you paste a URL into a browser and press Enter, the browser decodes these sequences back into the original characters for display β€” but the encoded form is what travels across the network.

How Percent Encoding Works

The mechanism is straightforward: take the character, find its UTF-8 byte value(s), write each byte as a two-digit uppercase hexadecimal number prefixed with a percent sign.

For single-byte ASCII characters:

  • Space (ASCII 32) β†’ %20
  • Exclamation mark ! (ASCII 33) β†’ %21
  • Hash # (ASCII 35) β†’ %23
  • Ampersand & (ASCII 38) β†’ %26
  • Plus + (ASCII 43) β†’ %2B
  • Equals = (ASCII 61) β†’ %3D
  • Question mark ? (ASCII 63) β†’ %3F
  • At sign @ (ASCII 64) β†’ %40

For multi-byte UTF-8 characters (non-ASCII, like accented letters or emoji), each byte in the UTF-8 sequence gets its own percent prefix. The letter Γ© (UTF-8: 0xC3 0xA9) becomes %C3%A9. The euro sign € (UTF-8: 0xE2 0x82 0xAC) becomes %E2%82%AC.

When to Encode vs Decode

Encode when: you're building a URL that contains user-supplied input, special characters, or non-English text. This includes: constructing API request URLs with query parameters, embedding search terms in URLs, generating share links with dynamic content, or creating redirect URLs in code.

Decode when: you receive a percent-encoded URL and need to read it as a human, debug an API request, check what a redirect target actually says, or extract readable text from a logged URL. Analytics dashboards and server logs often show percent-encoded URLs β€” decoding them makes the data understandable.

Note: never double-encode a URL. If a string is already percent-encoded, encoding it again will turn the % signs into %25, producing malformed results. Always decode first if you're unsure of the input state.

Common URL Encoding Examples

Here are the most frequently encoded characters and their encoded equivalents:

  • Space β†’ %20 (or + in form data/query strings)
  • & β†’ %26 (critical in query strings β€” raw & is a parameter separator)
  • = β†’ %3D (the key=value separator in query strings)
  • + β†’ %2B (+ has a special meaning as "space" in form encoding)
  • / β†’ %2F (slashes separate URL path segments)
  • ? β†’ %3F (the query string delimiter)
  • # β†’ %23 (the fragment identifier)
  • @ β†’ %40 (used in mailto: URLs and older URL auth syntax)
  • " β†’ %22 (quotes must be encoded in HTML href attributes)

URL Encoding in Query Strings

Query strings (the part of a URL after the ?) are the most common context for URL encoding errors. A query string like ?q=hello world&lang=en is invalid because the space and literal & need encoding. The correct form is ?q=hello%20world&lang=en.

There's also a subtle distinction between encodeURIComponent and encodeURI in JavaScript:

  • encodeURI encodes a full URL β€” it leaves characters like /, ?, #, and & intact because they're structural parts of the URL.
  • encodeURIComponent encodes a URL component (like a query parameter value) β€” it encodes /, ?, #, and & because those characters should not be interpreted as URL structure inside a parameter value.

For most practical tasks (encoding a search query or a parameter value), encodeURIComponent behavior is what you want. Online URL encoders default to this behavior.

How to Encode or Decode a URL Online

A browser-based URL encoder/decoder converts any string instantly:

  • To encode: paste your raw text (containing spaces, special characters, or non-ASCII) into the input, select Encode, and get the percent-encoded output.
  • To decode: paste a percent-encoded URL or string, select Decode, and read the human-readable result.

Combine URL encoding with other data tools for common workflows: format JSON with the JSON formatter before encoding it as a query parameter, or use the extra spaces remover to clean up strings before encoding them into URLs.

Frequently Asked Questions

What is the difference between %20 and + for spaces? +
Both represent spaces, but in different contexts. %20 is the correct percent-encoding of a space in URL paths and most URL components. The + sign means space only in the application/x-www-form-urlencoded format (HTML form submissions and query strings). In a URL path, a literal + means a plus sign, not a space. When in doubt, use %20.
Do I need to encode the entire URL or just parts of it? +
Only encode the parts that contain special characters β€” typically query parameter values and path segments with user-supplied data. The structural parts of a URL (scheme, host, path separators, query delimiters) should not be encoded. Encoding the entire URL including its structure will break it.
Why does my URL have %25 in it? +
%25 is the percent-encoded representation of the % character itself. If you see %25 where you expect %20 or another code, you likely double-encoded the string β€” encoded something that was already encoded. Decode once to recover the intended single-encoded form.
How do I encode a URL in JavaScript? +
Use encodeURIComponent() for encoding individual parameter values: encodeURIComponent("hello world") returns "hello%20world". Use encodeURI() only for encoding a full URL string while preserving URL structure. Never use the deprecated escape() function β€” it doesn't handle Unicode correctly.
Can I decode a URL that contains non-English characters? +
Yes. Non-ASCII characters like Γ©, ΓΌ, δΈ­, or emoji are encoded as multiple %XX sequences representing their UTF-8 bytes. A proper URL decoder reads these byte sequences and converts them back to the correct Unicode characters. For example, %C3%A9 decodes to Γ©.

Related Articles