How to encode a URL
- Paste the part that needs encoding: a search term, a query value, a path segment, or a complete parameter list.
- Press Encode URL. The tool applies JavaScript’s
encodeURIComponentrule set, which is the same one used by most URL builders and HTTP clients. - Copy the result into your link, form action, redirect parameter or API request. The output is plain ASCII, so it survives copy-paste through chat, email and ticketing systems.
- Need the reverse? Use URL Decode to turn escapes such as
%20back into readable text.
What percent-encoding actually does
A URL is a text string with a strict grammar. Letters, digits and a few punctuation marks are safe; everything else has to be escaped. Percent-encoding, defined in RFC 3986, replaces an unsafe character with a percent sign followed by the hexadecimal value of its bytes. The unreserved characters — A–Z, a–z, 0–9 and - . _ ~ — are never encoded, which is why an ordinary URL stays readable.
Non-ASCII text is encoded byte by byte in UTF-8 first. The Chinese character 你 is U+4F60, which is three UTF-8 bytes (E4 BD A0), so it becomes %E4%BD%A0. That is why a Chinese search term turns into a long run of percent escapes: the encoding stores bytes, not characters, and the receiving side has to decode them as UTF-8 to get the text back.
Reserved characters and their escapes
The characters below are the ones that most often break a URL when they are left raw inside a value. The table shows the escape this encoder produces for each of them.
| Character | Encoded | Why it matters in a URL |
|---|---|---|
| space | %20 | Not allowed literally in a URL |
| & | %26 | Separates query parameters |
| = | %3D | Separates a parameter name from its value |
| ? | %3F | Starts the query string |
| # | %23 | Starts the fragment, which is never sent to the server |
| / | %2F | Separates path segments |
| + | %2B | A literal plus; in form data a plus means a space |
| % | %25 | The escape character itself |
| : | %3A | Separates scheme, host and port |
| @ | %40 | Separates user info from a host |
| " | %22 | Unsafe in URLs and often stripped by tools |
| < > | %3C %3E | Unsafe in URLs and in HTML output |
One nuance is worth knowing. encodeURIComponent also leaves ! ' ( ) * unescaped. Those characters are allowed in URLs but can be special in other contexts, so if an API demands a fully conservative escape, replace them after encoding.
Spaces: %20 or +?
Both appear in the wild, and they mean different things. In a URL path or query string, a space is written %20. In application/x-www-form-urlencoded data — the body format used by classic HTML forms — a space is written as +, and a literal plus is written as %2B.
This tool always emits %20, because that is the correct escape for a URL component under RFC 3986. If you are building a form-encoded body for an API that expects plus signs, encode with this tool and then replace %20 with +. Do not do that for path segments or for query strings that a modern framework parses as RFC 3986, or the plus will arrive as a literal plus character.
Encode components, not the whole link
Because encodeURIComponent escapes every reserved character, pasting a complete https://… address encodes its own separators and produces a string that is no longer a working link. That is sometimes exactly right: when a URL is a value inside another URL, for example a redirect parameter, the inner address must be fully encoded.
When you need a link that works, encode only the values. Keep the scheme, host, path separators and the parameter names intact, and run this tool on the search term or the value side of each =. The distinction is the single most common reason percent-encoding appears to be broken.
URL encoding in code
Languages agree on the algorithm and disagree on the defaults, mostly about spaces and slashes. These are the equivalents of this tool.
| Language | Encode | Behaviour to know |
|---|---|---|
| JavaScript | encodeURIComponent(value) | Escapes : / ? # & =; encodeURI leaves them alone for whole URLs |
| Python 3 | urllib.parse.quote(value, safe='') | The default safe='/' keeps slashes; pass an empty safe set for a component |
| PHP | rawurlencode($value) | urlencode() uses + for spaces and is for form bodies |
| Java | URLEncoder.encode(value, StandardCharsets.UTF_8) | Encodes spaces as +; replace with %20 for a path |
| PowerShell | [Uri]::EscapeDataString($value) | Uses %20 for spaces; EscapeUriString keeps separators |
| Shell | jq -sRr @uri | Percent-encodes stdin; handy in pipelines and CI scripts |
Frequently asked questions
Should I encode the whole URL or just the parameters?
Encode only the values. A URL's structure depends on : / ? # & and =, so escaping the whole address destroys the structure. Run this tool on each query value or path segment, or use encodeURI for a complete URL when you only want to escape spaces and non-ASCII text.
Does this tool encode Chinese characters correctly?
Yes. Text is first turned into UTF-8 bytes and then escaped byte by byte, so 你好 becomes %E4%BD%A0%E5%A5%BD. When the receiving server decodes those escapes as UTF-8, the original characters come back exactly. The same applies to Japanese, Korean, Arabic and emoji.
What is the difference between URL encoding and Base64?
URL encoding makes text safe inside a URL; Base64 makes binary data safe inside a text channel. They are not interchangeable, and a Base64 decoder will reject a percent-encoded string. Neither one is encryption, and neither should be used to hide sensitive data.
Why does my URL show %20 instead of a space?
Literal spaces are not allowed in a URL, so browsers and HTTP libraries encode them. %20 is the escape for one space in a path or query component. If a service shows + instead, it is using HTML form encoding, where + means a space and %2B means a literal plus.
Is percent-encoding case-sensitive?
The hexadecimal digits are not: %2f and %2F are the same byte. This encoder writes uppercase letters, which is the conventional form. What is case-sensitive is the decoded value itself, because uppercase and lowercase letters are different bytes and decode to different text.