Percent-encode or decode URLs and query strings. Supports encodeURIComponent, encodeURI, and query string (+ for spaces) encoding.
Input - Plain Text / URL
Output - Encoded
Ctrl+Shift+CCopyCtrl+KClearCtrl+DDownload
Share this tool
Found it useful? Help a fellow developer discover it.
https://developertoolkit.dev/tools/url-encoder
What is URL encoding?
URL encoding (also called percent-encoding) replaces characters that are not allowed or have special meaning in URLs with a % followed by two hexadecimal digits representing the character's UTF-8 byte value. For example, a space becomes %20 and & becomes %26.
This is defined in RFC 3986 and is essential for safely passing arbitrary data as URL query parameters or path segments.
Encoding methods compared
Method
Reserved chars left as-is
When to use
encodeURIComponent
- _ . ! ~ * ' ( )
Encode a single query parameter value or path segment. Most common choice. Encodes everything except unreserved characters.
encodeURI
; , / ? : @ & = + $ # - _ . ! ~ * ' ( )
Encode a full URL while keeping its structure intact. Does not encode characters that have special meaning in a URL (/, ?, &, =, #, etc.).
Query string (+)
- _ . ! ~ * ' ( )
application/x-www-form-urlencoded encoding used in HTML forms and query strings. Same as encodeURIComponent but spaces become + instead of %20.
Common encoded characters
Character
Encoded
Note
%20 / +
%20 in paths, + in query strings
&
%26
Query parameter separator
=
%3D
Key=value separator
+
%2B
Avoid ambiguity with the space shorthand
#
%23
Fragment identifier
?
%3F
Query string start
/
%2F
Path separator (encodeURIComponent only)
@
%40
Userinfo separator (encodeURIComponent only)
:
%3A
Scheme / port separator (encodeURIComponent only)
Frequently Asked Questions
How do I URL encode a string online?
Paste your string into the input panel and select the Encode direction. Choose encodeURIComponent for query parameter values, encodeURI for a full URL, or Query string for HTML form encoding. The encoded output appears instantly. Click Copy to copy it to your clipboard.
Why should I URL encode query parameters?
Query parameters can contain characters that have special meaning in URLs, such as &, =, ?, #, and spaces. If these are not encoded, the server may misinterpret the parameter boundaries. For example, a parameter value containing & would be split into two separate parameters. Encoding ensures the value is transmitted exactly as intended.
When should I use encodeURIComponent vs encodeURI?
Use encodeURIComponent when encoding a single value that will appear inside a URL, such as a query parameter value or a path segment with special characters. Use encodeURI only when you have a complete URL and want to make it safe to transmit without breaking its structure. encodeURI deliberately leaves /, ?, &, and # unencoded because they are structural.
What is the difference between %20 and + for spaces?
%20 is the correct percent-encoding for a space per RFC 3986 and is valid everywhere in a URL. The + convention comes from the older application/x-www-form-urlencoded format used by HTML forms and is only valid in the query string portion of a URL, not in paths or hostnames.
Why does decoding fail for some inputs?
Decoding fails when the input contains a malformed percent-encoded sequence, for example %ZZ (not valid hex) or a lone % not followed by two hex digits. This converter first tries decodeURIComponent and falls back to decodeURI for more lenient parsing. If both fail, the input is genuinely malformed.
Does this tool handle Unicode characters?
Yes. Non-ASCII characters such as accented letters, CJK characters, or emoji are first encoded to their UTF-8 byte sequences, then each byte is percent-encoded. For example, the character é becomes %C3%A9 (two bytes in UTF-8). Decoding reverses the process.
Can I encode an entire URL at once?
Yes. Use the encodeURI method, which preserves the structural characters of a URL (scheme, host, path separators, query string delimiters). Use encodeURIComponent only if you want to encode the entire string including structural characters, which is appropriate when the URL itself is a parameter value such as a redirect_uri.
What is the difference between URL encoding and Base64 encoding?
URL encoding (percent-encoding) makes a string safe to include in a URL by replacing unsafe characters with %XX sequences. Base64 encoding converts binary or arbitrary data into a printable ASCII string using a 64-character alphabet. URL encoding is used specifically for URL safety. Base64 is used to represent binary data as text in HTTP headers, data URIs, and JSON payloads.