HomeFormattersDataURL Encoder / Decoder

URL Encoder / Decoder

Data

Encode special characters in URLs using percent-encoding, or decode percent-encoded URLs back to plain text. Free, instant, client-side — nothing is uploaded.

What is a URL Encode?

A URL Encoder / Decoder converts text to and from percent-encoding — the mechanism defined in RFC 3986 for safely embedding arbitrary characters in a URL. URLs may only contain a restricted set of characters: unreserved characters (letters, digits, -, _, ., ~) and a fixed set of reserved characters that carry structural meaning (:, /, ?, #, [, ], @, !, $, &, ', (, ), *, +, ,, ;, =). Any other character — spaces, accented letters, symbols — must be percent-encoded by replacing each byte with %XX, where XX is the byte's hexadecimal value.

This tool exposes two encoding functions used in JavaScript and every web platform:

  • encodeURIComponent — encodes a single URL component (a query parameter value, a path segment). Encodes everything except letters, digits, and - _ . ! ~ * ' ( ). Use this for data values within a URL.
  • encodeURI — encodes a complete URI while preserving its structural characters (:, /, ?, #, &, =, etc.). Use this when you want to make an entire URL text-safe without breaking its structure.

Decoding always uses decodeURIComponent, which handles all percent-encoded sequences correctly. If you need to encode binary data for non-URL contexts, use the Base64 Encoder / Decoder instead.


How to use this URL Encode calculator

  1. Paste your text or encoded URL into the Input field.
  2. Select Encode → percent-encoded or Decode ← percent-encoded from the Mode selector.
  3. For encoding, select the Scope: Encode component for query parameter values, or Encode full URI for a complete URL.
  4. The output appears instantly in the Output field.
  5. Copy the result using the copy icon.

Formula & Methodology

Encoding a component (encodeURIComponent):
- Encodes all characters except: A–Z a–z 0–9 - _ . ! ~ * ' ( )
- Each character is converted to its UTF-8 byte sequence, each byte expressed as %XX
- Example: hello worldhello%20world
- Example: name=value&key=othername%3Dvalue%26key%3Dother

Encoding a full URI (encodeURI):
- Same as above but additionally preserves: ; , / ? : @ & = + $ #
- Example: https://example.com/search?q=hello worldhttps://example.com/search?q=hello%20world

Decoding (decodeURIComponent):
- Replaces each %XX sequence with the corresponding UTF-8 byte, then decodes the byte sequence as Unicode text

Valid example: q=hello world&lang=enq=hello%20world%26lang%3Den (component-encoded)

Invalid decode example: hello%2Gworld%2G is malformed because G is not a valid hexadecimal digit
Frequently Asked Questions
What is URL encoding (percent-encoding)?
URL encoding, formally called percent-encoding, replaces characters that are not allowed or have special meaning in URLs with a % sign followed by two hexadecimal digits representing the character's UTF-8 byte value. For example, a space becomes %20, and & becomes %26. This allows arbitrary text to be safely embedded in URLs without breaking their structure.
What is the difference between encodeURI and encodeURIComponent?
encodeURI encodes a complete URI and preserves characters that are part of the URL structure — it does not encode :, /, ?, #, &, =, @, and a few others. encodeURIComponent encodes a single component (such as a query parameter value) and encodes everything except letters, digits, and - _ . ! ~ * ' ( ). Use encodeURIComponent for query parameter values; use encodeURI when you want to encode a full URL.
When should I use URL encoding?
Use URL encoding when: building URLs programmatically with user-supplied values (names, search queries, addresses), constructing query string parameters that contain special characters like &, =, or spaces, passing data in GET request parameters, and encoding form data in application/x-www-form-urlencoded format.
Why does a space become %20 in some cases and + in others?
In the URI standard (RFC 3986), spaces are encoded as %20. In the older application/x-www-form-urlencoded format used by HTML forms, spaces are encoded as +. Both are valid in their respective contexts. encodeURIComponent always produces %20; HTML form submission may produce +. When decoding, %20 and + in form data both represent a space.
What characters are safe in a URL and don't need encoding?
The unreserved characters that never need encoding are: A–Z, a–z, 0–9, hyphen (-), underscore (_), dot (.), and tilde (~). Reserved characters like / # ? & = have structural roles in URLs and should only appear in their syntactic positions — they must be encoded when used as literal data values in a query parameter.
Can I URL-decode a full URL without breaking it?
Yes — use the 'Decode ← percent-encoded' mode with 'Encode full URI' scope. decodeURI decodes %XX sequences while leaving the structural reserved characters intact. This is useful for making encoded URLs readable without breaking their structure.
Is my URL stored when I use this tool?
No. All encoding and decoding runs entirely in your browser — nothing is transmitted to any server. URLs often contain paths, query strings, or authentication tokens that are sensitive, so client-side processing is essential.
What is a percent-encoded sequence?
A percent-encoded sequence is a % character followed by exactly two uppercase hexadecimal digits representing one byte of a UTF-8 encoding. For example, the euro sign € is encoded as three bytes (0xE2, 0x82, 0xAC) which become %E2%82%AC in a URL. Sequences like %2G (G is not a valid hex digit) or a lone % with no following digits are malformed.
What does the Scope option do?
'Encode component' uses encodeURIComponent — it encodes everything except letters, digits, and a few safe punctuation marks. Use this for individual query parameter names and values. 'Encode full URI' uses encodeURI — it preserves URL-structural characters like :, /, ?, &, #, and =. Use this when you want to encode an entire URL while keeping its structure intact.
How is URL encoding different from Base64?
Both convert data to a text-safe representation, but for different purposes. URL encoding (percent-encoding) is specifically for URLs — it encodes characters not safe in URI syntax using %XX notation. Base64 converts arbitrary bytes to a 64-character alphabet, primarily for embedding binary data in text formats like JSON or email. For Base64 encoding, use the [Base64 Encoder / Decoder](/base64-formatter/).
What should I do if decoding returns an error?
A decoding error means the input contains a malformed percent-encoded sequence — typically a % not followed by two valid hexadecimal digits (e.g. %GG or a trailing % with nothing after it). Identify and fix the malformed sequence in the input. Sometimes these appear when a URL has been double-encoded (%25 instead of %).