URL Encoder & Decoder
Encode text for safe use in a URL, or decode a percent-encoded string back to plain text — instantly, in your browser.
- Free — No signup required
- Instant — Results update as you type
- Private — Processed in your browser
A URL can only contain a limited set of characters, and several of those have structural meaning: ? starts the query, & separates parameters, # begins a fragment, / divides path segments. Percent-encoding replaces every other character, and every reserved character used as data, with % followed by two hexadecimal digits. This tool applies that transformation to a single component and reverses it.
How it works
Encode runs encodeURIComponent on your text. Every character except the unreserved set A–Z a–z 0–9 - _ . ! ~ * ' ( ) is converted to UTF-8 bytes and each byte is written as %XX. A space becomes %20, & becomes %26, and é becomes the two bytes %C3%A9. Encoding never fails.
Decode runs decodeURIComponent. It fails, with a clear message, when a % is not followed by two hex digits or when the decoded bytes do not form valid UTF-8, for example %E9 on its own, which is Latin-1 rather than UTF-8. Text without any percent sequences decodes to itself.
The key word is component. The encoder is meant for one value, such as a query parameter or a path segment, not for a whole URL. Feeding https://example.com/a?b=c through it produces https%3A%2F%2Fexample.com%2Fa%3Fb%3Dc, which is the correct result for embedding that URL as a parameter value (a redirect target, say) and the wrong result if you wanted a usable link.
The plus sign
Form submissions encoded as application/x-www-form-urlencoded write a space as +, and + itself as %2B. That convention belongs to HTML forms, not to URLs in general. This tool follows the URI rules from RFC 3986, so a space is always %20 and a + passes through untouched. If a server complains that your spaces arrived as literal plus signs, the sender used the form rule and the receiver expected the URI rule, or vice versa; the fix is to be explicit about which one each side applies.
Encoding twice
The most common bug is double encoding: a value that already contains %20 is encoded again and becomes %2520. It happens when a framework encodes automatically and the developer encodes by hand as well. If decoding your string once still leaves %XX sequences behind, it was encoded twice; decode again and remove one of the encoding steps in the code.
The reverse mistake is decoding too early. A parameter value that contains & must stay encoded until the query string has been split into pairs, otherwise it will be read as two parameters.
Command-line equivalent
jq can encode a value, and Python's standard library can do both directions:
jq -rn --arg s 'a b&c=d' '$s | @uri' # a%20b%26c%3Dd
python3 -c 'import urllib.parse as u,sys; print(u.unquote(sys.argv[1]))' 'a%20b%26c'
Note that Python's quote leaves / unencoded by default, which differs from encodeURIComponent; pass safe='' to match.
Learn more
Deciding what goes in the path, what goes in the query and how identifiers containing special characters should look is part of API design; REST API design covers those conventions. The OAuth 2.0 authorisation-code flow is built almost entirely from redirect URLs carrying encoded parameters, and the OAuth 2.0 guide shows what a correctly encoded redirect_uri and state look like in practice. For bytes that need to travel as text rather than inside a URL, use the Base64 encoder.
FAQ
- What's the difference between URL encoding and Base64 encoding?
- URL encoding (percent-encoding) replaces unsafe characters in a URL with %XX sequences so the URL remains valid; Base64 encoding converts arbitrary binary or text data into a compact ASCII representation for transport. They solve different problems and aren't interchangeable.
- Why does decoding fail on my input?
- Percent-encoded sequences must be a % followed by exactly two valid hex digits, and any multi-byte UTF-8 sequences must be complete. A stray %, invalid hex digits, or a truncated sequence will fail to decode — the error message tells you the input isn't valid percent-encoding.
- Does this encode a + as a space, like form data does?
- No. This tool uses encodeURIComponent/decodeURIComponent semantics, which never convert between + and space — that conversion is specific to application/x-www-form-urlencoded form bodies, not general URL components.