URL Encode / Decode

URL Encoder & Decoder

Encode or decode URL components and query strings instantly

Plain Text
URL-Encoded Output
Output will appear here...

Free Online URL Encoder & Decoder

Encode any text into a URL-safe format or decode percent-encoded strings back to readable text instantly. Choose betweenencodeURIComponent andencodeURIdepending on your use case. Everything runs in your browser โ€” your data never leaves your device.

What is URL Encoding?

URL encoding (also called percent-encoding) is a mechanism for encoding characters in a Uniform Resource Identifier (URI). It replaces unsafe or reserved ASCII characters with a%followed by two hexadecimal digits representing the character's byte value. For example, a space becomes %20 and an ampersand becomes %26.

URL encoding is defined in RFC 3986 and is essential for transmitting data in URLs because certain characters have special meaning in the URL syntax (such as &,=,?, and/). Without encoding, these characters would be interpreted as URL delimiters rather than literal values.

Common Percent-Encoded Characters

Here are commonly encoded characters and their percent-encoded representations:

CharacterEncodedDescription
%20Space
&%26Ampersand (query parameter separator)
=%3DEquals (key-value separator)
?%3FQuestion mark (query string start)
/%2FForward slash (path separator)
#%23Hash (fragment identifier)
%%25Percent sign (escape character)
+%2BPlus sign
@%40At sign
:%3AColon (scheme separator)
!%21Exclamation mark
'%27Single quote / apostrophe
(%28Open parenthesis
)%29Close parenthesis

encodeURI vs encodeURIComponent

JavaScript provides two built-in functions for URL encoding. They differ in which characters they encode:

FeatureencodeURIencodeURIComponent
PurposeEncode a full URIEncode a URI component (e.g., query value)
EncodesSpaces, non-ASCII, some specialsEverything except A-Z a-z 0-9 - _ . ! ~ * ' ( )
Preserves: / ? # [ ] @ ! $ & ' ( ) * + , ; = - _ . ~Only unreserved chars
Use caseEncoding an entire URL stringEncoding query parameter keys/values
Example inputhttps://example.com/path?q=hello worldhello world&foo=bar
Example outputhttps://example.com/path?q=hello%20worldhello%20world%26foo%3Dbar

Rule of thumb: UseencodeURIComponent for individual query parameter values and path segments. UseencodeURI when you need to encode an entire URL while preserving its structure.

Common Use Cases

Query Parameters

Encode user input before appending it to a URL query string so special characters don't break the URL structure.

Form Submissions

HTML forms with application/x-www-form-urlencoded content type percent-encode all field values before sending.

API Requests

Encode dynamic values in REST API endpoint URLs and query strings to ensure valid HTTP requests.

Redirect URLs

When passing a URL as a parameter (e.g., ?redirect=https://...), encode it so slashes and colons are preserved as data.

Email Links (mailto)

Encode subject lines and body text in mailto: links to handle spaces, ampersands, and special characters.

Internationalized URLs

Encode non-ASCII characters (accented letters, CJK, emoji) in URLs to comply with the URI specification.

Frequently Asked Questions

They are the same thing. URL encoding and percent-encoding both refer to the mechanism defined in RFC 3986 where unsafe characters are replaced with a percent sign (%) followed by two hexadecimal digits. The terms are used interchangeably.

Use encodeURIComponent when encoding individual query parameter values, path segments, or any fragment of a URL. Use encodeURI when encoding an entire URL string where you want to preserve the structural characters like ://?#&=. In most cases, encodeURIComponent is what you need.

Percent-encoding (%20) is the standard defined in RFC 3986 for encoding spaces in URIs. The plus sign (+) for spaces comes from the application/x-www-form-urlencoded format used in HTML form submissions. Both are valid in query strings, but %20 is the universal standard.

Yes. Everything runs entirely in your browser using JavaScript's built-in encodeURIComponent, encodeURI, decodeURIComponent, and decodeURI functions. Your text is never uploaded, transmitted, or stored on any server.

Yes. Non-ASCII characters like accented letters, CJK characters, and emoji are encoded as their UTF-8 byte sequences in percent-encoded form. For example, the emoji ๐Ÿ˜€ becomes %F0%9F%98%80 (its four UTF-8 bytes).

Unreserved characters that never need encoding are: A-Z, a-z, 0-9, hyphen (-), underscore (_), period (.), and tilde (~). All other characters may need encoding depending on where they appear in the URL.

Yes. Select 'encodeURI' from the method dropdown to encode a full URL while preserving its structural characters (://?#[]@!$&'()*+,;=). To encode everything including those characters, use 'encodeURIComponent' instead.

The tool will show an error message. Invalid sequences (like a lone % not followed by two hex digits, or invalid UTF-8 byte sequences) cannot be decoded and will be flagged as invalid input.