SEOLyzerPro
Use 47 free online tools: meta tag and robots.txt generators, image and text tools, JSON converters, calculators and unit converters. No signup needed
URL Encode
Make text safe to use in a web address
URL Encode
What this tool does
The URL Encode tool converts text into a form that is safe to use inside a web address. Characters such as spaces, ampersands, question marks and letters from other languages cannot appear in a URL as they are, so they are replaced by a percent sign followed by two hexadecimal digits. This is called percent-encoding. Enter your text, click Encode, and copy the result. It is useful for query strings, links in emails, API requests, redirects, tracking parameters and any link that contains special characters.
How to use it
- Enter or paste the text that you want to place in a URL.
- Click Encode.
- Copy the result and use it in your link.
- Use Reset to start again.
Worked examples
| Original text | Encoded text |
|---|---|
| hello world | hello%20world |
| Tom & Jerry | Tom%20%26%20Jerry |
| a=1&b=2 | a%3D1%26b%3D2 |
| price: 50% off | price%3A%2050%25%20off |
| café | caf%C3%A9 |
| اردو | %D8%A7%D8%B1%D8%AF%D9%88 |
| 😀 | %F0%9F%98%80 |
How percent-encoding works
Each character that is not allowed is first turned into bytes using UTF-8, and then each byte is written as a percent sign and two hexadecimal digits. A space is the byte 32, which is 20 in hexadecimal, so it becomes %20. The ampersand is byte 38, which is 26 in hexadecimal, so it becomes %26. The percent sign itself becomes %25.
Characters outside basic English take more than one byte. The letter é has two bytes, C3 and A9, so it becomes %C3%A9. Each Urdu letter in the example above takes two bytes, so four letters give eight encoded bytes. The emoji in the table takes four bytes, F0, 9F, 98 and 80.
Which characters are safe
The characters that never need encoding are called unreserved characters. They are the letters A to Z and a to z, the digits 0 to 9, and four symbols: hyphen (-), underscore (_), period (.) and tilde (~).
A second group, the reserved characters, have a special job in a URL: : / ? # [ ] @ ! $ & ' ( ) * + , ; =. For example, the question mark starts the query string, the ampersand separates parameters, and the equals sign joins a name to a value. If one of these characters is part of your data, and not part of the URL structure, it must be encoded. Otherwise, the browser or the server will read it as structure.
Encoding a part or the whole address
This is the most common source of mistakes. In JavaScript, there are two functions with different jobs:
- encodeURIComponent is meant for one piece of a URL, such as a parameter value. It encodes almost everything, including
/,?,&,=,:and#. - encodeURI is meant for a complete URL. It leaves the characters that give a URL its structure, so the address still works.
If you encode a whole address with the component method, the result is broken: https://example.com/page becomes https%3A%2F%2Fexample.com%2Fpage, which is no longer a clickable link. In practice, you should usually encode only the value that you put into a parameter, and leave the rest of the address as it is. For example, to search for “seo tools & tips”, build the link like this:
https://example.com/search?q=seo%20tools%20%26%20tips
Space: %20 or plus?
In a URL path and in modern use, a space is %20. In the older form-submission format, called application/x-www-form-urlencoded, a space in a query string can be written as a plus sign (+). Both appear in real links, and servers usually understand both in a query string. But in a path, a plus sign means a real plus. If you are unsure, %20 is the safer choice.
Double encoding
If you encode text that is already encoded, the percent signs are encoded again. For example, hello%20world becomes hello%2520world, because % becomes %25. The server then decodes it once and sees “hello%20world” with the characters %20 still in it, which is not what you wanted. Encode data only once, and only at the moment you insert it into the URL. If you see %25 in an address, a double encoding is a likely cause.
Where it is used
- Search and filter links with parameters such as ?q=...&sort=...
- Tracking and campaign links, where values contain spaces or symbols.
- Redirect addresses, where one URL is placed inside another, for example
?next=https%3A%2F%2Fexample.com%2Fpage. - APIs, where parameters must be encoded correctly.
- Email and chat links with long text.
- Links in languages other than English, as in the Urdu example above. Modern browsers can show decoded text in the address bar, but they send encoded bytes.
- Fixing broken links that contain spaces or brackets.
Tips for good results
- Encode each value separately, then join the parts with & and =.
- Do not encode the whole URL with a component-level tool.
- Do not encode twice.
- Use lowercase and hyphens for the path of your own pages. This is easier than encoding. The Text to Slug tool helps with that.
- Test the final link in a browser, and check it with the Redirect Checker if the link redirects.
- Hexadecimal letters in a percent code, such as %C3, can be written in upper or lower case. Upper case is the convention.
Encoding is not security
Percent-encoding makes text safe for transport in a URL. It does not hide it or protect it. Anyone can decode it, and a URL can appear in browser history, server logs and shared links. Never put passwords, private tokens or personal data in a URL, even if encoded. Server code must also check and handle all incoming values, because encoded text can contain anything.
Privacy
“The encoding happens in your browser and your text is not sent to our server.”
Limits of this tool
The tool changes characters into percent codes. It does not check whether the final link works, shorten it, or judge whether the value is safe. Different systems follow slightly different rules for a few characters, such as the space and the plus sign, so test important links.
Frequently asked questions
Why does a space become %20?
The space is byte 32, which is 20 in hexadecimal, and a percent sign marks an encoded byte.
Should I encode the whole address?
Usually only the values, not the whole link.
What is the difference between %20 and +?
Both can mean a space in a query string, but %20 works everywhere.
Why do I see %25 in my link?
The text was probably encoded twice.
Related tools
Text to Slug, Base64 Encode, Base64 Decode, Redirect Checker, QR Code Generator and Meta Tag Generator.