How URL Encoding Works
Paste any text and this tool percent-encodes it for safe use inside a URL. Spaces become %20, ampersands become %26, and characters outside the safe ASCII set are converted to their UTF-8 byte sequences. The result updates as you type.
URL encoding exists because URLs have a restricted character set. Only letters, digits and a handful of symbols are safe to use literally; everything else has to be represented as a percent sign followed by its hexadecimal byte value.
How to Use This Tool
Paste the text to encode
Usually a query-string value, a search term, or a URL that will itself be passed as a parameter.
Copy the encoded result
Reserved characters, spaces and non-ASCII characters are replaced with percent-escapes.
Insert it into your URL
Place the encoded value after the = in a query parameter, or wherever the raw text would have broken the URL.
Test the finished link
Open it, or decode it again with the URL Decoder, to confirm it round-trips.
Why Encoding is Necessary
Certain characters have structural meaning inside a URL. A question mark starts the query string, an ampersand separates parameters, a hash starts a fragment, and a slash separates path segments. If your data contains any of those characters literally, the URL breaks in a way that is often silent.
The classic failure is a search query containing an ampersand. A link to /search?q=shoes&socks is parsed as two parameters — q=shoes and socks — and your search page receives only “shoes”. Encoded as /search?q=shoes%26socks, the whole string arrives intact as one value.
Spaces are the other common case. Unencoded spaces break links when copied into plain-text contexts like emails, where the address is truncated at the first space. Encoded as %20, the URL survives being pasted anywhere.
Which Characters Get Encoded
- Always safe, never encoded: A–Z, a–z, 0–9, and the characters - _ . ! ~ * ' ( )
- Reserved characters that must be encoded when used as data: ; / ? : @ & = + $ , #
- Space becomes %20 in paths and query values.
- Non-ASCII characters — accented letters, Arabic, Chinese, emoji — are converted to UTF-8 bytes, so a single character often becomes several percent-escapes.
Encoding and SEO
For URL slugs, the best encoding is none. A slug containing encoded characters is harder to read, harder to share, and less appealing in search results where the URL is displayed. /best-running-shoes reads well; /best%20running%20shoes does not.
The practical rule is to design slugs from the safe character set in the first place — lowercase letters, digits and hyphens — rather than encoding whatever the page title happened to be. The URL Slug Generator does exactly this conversion.
Encoding belongs in query strings and parameter values, where arbitrary data has to travel safely. That is where this tool earns its place: campaign values, search terms, and filter parameters that might contain spaces or symbols.
Non-English URLs and IDNs
URLs containing non-ASCII characters are legal and widely supported. Browsers display them in readable form and encode them behind the scenes, so a URL with Arabic or Chinese characters in the path works fine and often looks better to a native-language audience than a transliterated version.
The two things to watch are consistency and portability. The encoded form is what gets stored in analytics, logs and sitemaps, so reports become harder to read. And older systems occasionally mangle encoded UTF-8 sequences.
Domain names work differently again. Internationalised domain names are encoded with Punycode rather than percent-encoding, producing the xn-- prefixes you sometimes see. That conversion is separate from what this tool does.
Common Encoding Mistakes
- Double-encoding — running already-encoded text through an encoder again, turning %20 into %2520 and breaking the value.
- Encoding the whole URL including the protocol and slashes, which produces a string no browser can resolve.
- Encoding the slug rather than designing a clean one, giving you ugly URLs that are technically valid.
- Forgetting to encode user-supplied values inserted into query strings, which breaks on the first ampersand someone types.
- Assuming a plus sign means a space. It does in form submissions, but %20 is the correct encoding in a path.
Going the Other Way
To read an encoded URL, the URL Decoder converts it back to plain text — useful when debugging a redirect chain or working out what a tracking URL actually contains.
If you are inspecting a URL's parameters rather than the whole string, the URL Parameter Extractor splits the query string into a decoded key-value table, which is usually faster than decoding by eye.
Encode a Value, Not a Whole URL
This encoder works like JavaScript's encodeURIComponent: it encodes every reserved character, including the colon, slashes, question mark and ampersand. That is exactly right for a value going into a query string, and exactly wrong for a whole URL — https://example.com/page becomes https%3A%2F%2Fexample.com%2Fpage, which no longer works as a link.
Encode each piece of data separately and assemble the URL afterwards. The one time to encode a complete URL is when it is itself a parameter value, such as a redirect target: ?next=https%3A%2F%2Fexample.com%2Fpage.
Common Percent Codes
- Space — %20
- ! — %21 (left as-is by this encoder, since it is safe)
- # — %23
- $ — %24
- & — %26
- + — %2B
- , — %2C
- / — %2F
- : — %3A
- ; — %3B
- = — %3D
- ? — %3F
- @ — %40
- é — %C3%A9 (two UTF-8 bytes)
URL Encoding in Code
- JavaScript — encodeURIComponent() for values, encodeURI() for a full URL that should keep its structure.
- Python — urllib.parse.quote() keeps slashes by default; quote_plus() encodes spaces as + for form data.
- PHP — rawurlencode() uses %20 for spaces; urlencode() uses +, matching HTML form encoding.
- Java — URLEncoder.encode() produces form encoding, so spaces become +.
- Most HTTP libraries encode query parameters for you when you pass them as a map rather than building the string by hand.
Frequently Asked Questions
When do I need to URL-encode something?
Whenever you insert arbitrary data into a URL — a search term, a campaign value, a filename — and that data might contain spaces, ampersands, question marks or other reserved characters. Slugs are the exception: design those from safe characters instead.
What does %20 mean?
It is an encoded space. The percent sign signals an escape sequence and 20 is the hexadecimal byte value for a space character. Encoding is why URLs containing spaces survive being pasted into emails and chat.
Should my page URLs contain encoded characters?
Ideally not. Encoded slugs are harder to read and share, and look worse in search results. Build slugs from lowercase letters, digits and hyphens instead — encoding belongs in query string values, not in paths.
What is double-encoding and why is it a problem?
It happens when already-encoded text is encoded again, so %20 becomes %2520 — the percent sign itself gets escaped. The receiving server then decodes it once and gets %20 as literal text rather than a space, and the value is wrong.
Is a plus sign the same as %20?
Only in the query string of form submissions, where a plus historically represents a space. In a URL path, a plus is a literal plus sign and %20 is the correct space encoding. This tool uses %20.
Why did my whole URL get encoded, including https://?
This tool encodes everything reserved, which is correct for a single value. Encode only the parts that are data — a search term, a parameter value — and leave the scheme, domain and slashes as they are.
What is the difference between encodeURI and encodeURIComponent?
encodeURI leaves characters that give a URL its structure — : / ? & = # — unencoded, so a full URL still works. encodeURIComponent encodes those too, for use on individual values. This encoder behaves like encodeURIComponent.
How do I URL-encode a space?
As %20. In HTML form submissions and some query strings a space is written as + instead, but %20 is valid everywhere.