ToolsleFree tools · toolsle.com
Encoding mode

Characters: 0

Output characters: 0

URL Analyzer

Protocol
Host
Port
Path
Query
Fragment / Hash
Advertisement

URL Encoder/Decoder

URL Encoder/Decoder — Percent Encode and Decode URLs Online

Our free URL encoder and decoder converts text and URLs to percent-encoded format instantly — and decodes them back to readable text. Paste a URL to analyze its components, encode individual query parameters, or decode a garbled URL full of percent signs. Everything runs in your browser with no data sent to any server.

What Is URL Encoding?

URL encoding, also called percent encoding, is a method of representing special characters in a URL using a percent sign followed by two hexadecimal digits. URLs can only contain a limited set of characters from the ASCII character set. Any character outside this set, or any reserved character used as literal data rather than as a URL delimiter, must be encoded.

For example, if you want to include the search query "hello world & more" as a URL parameter, the space becomes %20 and the ampersand becomes %26, producing: ?q=hello%20world%20%26%20more

URL Encoding Reference — Common Characters

Here are the most frequently encountered characters and their URL-encoded equivalents:

CharacterEncodedDescription
Space%20Most common encoding need
!%21Exclamation mark
"%22Double quote
#%23Hash / fragment delimiter
$%24Dollar sign
%%25Percent sign itself
&%26Ampersand / query param separator
'%27Single quote / apostrophe
(%28Open parenthesis
)%29Close parenthesis
*%2AAsterisk
+%2BPlus sign (also means space in forms)
,%2CComma
/%2FForward slash / path separator
:%3AColon
;%3BSemicolon
=%3DEquals sign / param value separator
?%3FQuestion mark / query string start
@%40At sign
[%5BOpen bracket
]%5DClose bracket
{%7BOpen brace
}%7DClose brace

encodeURI vs encodeURIComponent

JavaScript provides two built-in functions for URL encoding, each suited to different use cases:

FunctionPreservesEncodesBest Used For
encodeURI(): / ? # [ ] @ ! $ & ' ( ) * + , ; = and unreserved charsSpaces, Unicode, and other special charsEncoding a complete URL
encodeURIComponent()A-Z a-z 0-9 - _ . ! ~ * ' ( ) onlyAll reserved and special chars including & = + # : /Encoding individual query parameter values
decodeURI()Decoding a full encoded URL
decodeURIComponent()Decoding individual encoded values
Advertisement

URL Structure — Anatomy of a URL

Understanding URL structure helps you know which parts need encoding and which delimiters should be preserved:

ComponentExampleDescription
Protocolhttps://Communication scheme
Hosttoolsle.comDomain name or IP address
Port:8080Optional, defaults to 80/443
Path/tools/url-encoderResource location on the server
Query?q=hello+world&lang=enKey-value parameters after ?
Fragment#section-2Client-side anchor after #

Common URL Encoding Mistakes

Double Encoding

Double encoding happens when an already-encoded URL is encoded again. For example, encoding %20 produces %2520 — the % itself gets encoded to %25. This causes broken URLs and failed requests. Always decode before re-encoding to avoid this. The URL analyzer in this tool shows if your URL contains double-encoded sequences.

Encoding the Entire URL

A common mistake is using encodeURIComponent() on a full URL, which encodes the : and // in https://, the / path separators, and the ? and & query delimiters, breaking the URL structure. Use encodeURI() for full URLs and encodeURIComponent() only for individual parameter values.

Forgetting to Encode User Input

When building URLs programmatically with user-supplied values, always encode each parameter value separately with encodeURIComponent(). Failing to do so can break URLs when users input characters like &, =, #, or non-ASCII characters.

URL Encoding in Different Languages

LanguageEncodeDecode
JavaScriptencodeURIComponent(str)decodeURIComponent(str)
Pythonurllib.parse.quote(str)urllib.parse.unquote(str)
PHPurlencode($str)urldecode($str)
JavaURLEncoder.encode(str, "UTF-8")URLDecoder.decode(str, "UTF-8")
C#Uri.EscapeDataString(str)Uri.UnescapeDataString(str)
RubyURI.encode_www_form_component(str)URI.decode_www_form_component(str)
Gourl.QueryEscape(str)url.QueryUnescape(str)
Rusturlencoding::encode(str)urlencoding::decode(str)

Frequently Asked Questions

What does %20 mean in a URL?

%20 is the percent-encoded representation of a space character. The hexadecimal value 20 is the ASCII code for a space. When you see %20 in a URL it means a space was encoded there — for example, "hello%20world" decodes to "hello world".

What is the difference between %20 and + in a URL?

Both represent a space but in different contexts. %20 is the standard percent encoding of a space and works in all URL positions. The + character represents a space only in HTML form data (application/x-www-form-urlencoded format) — specifically in query strings submitted from forms. In path segments, + is a literal plus sign, not a space.

How do I encode a URL in JavaScript?

To encode a full URL use encodeURI(url). To encode a query parameter value use encodeURIComponent(value). For example: const url = 'https://example.com/search?q=' + encodeURIComponent(userInput);

Why does my encoded URL have %C3%A9 in it?

%C3%A9 is the URL encoding of the character é (e with acute accent). Non-ASCII characters like accented letters are first encoded in UTF-8 (which may produce multiple bytes), then each byte is percent-encoded. é in UTF-8 is two bytes: 0xC3 and 0xA9, giving %C3%A9.

Can I use this tool to fix broken URLs?

Yes. If you have a URL with visible percent-encoded sequences like %20 or %3D that should be readable, paste it into Decode mode to see the human-readable version. If you have a URL with special characters that needs to be made safe for use in a browser or API request, paste it into Encode mode.

Advertisement