URL Encoder
URL encoding, also called percent-encoding, replaces characters that are unsafe in a URL with a % sign and their UTF-8 byte values in hexadecimal: a space becomes %20 and & becomes %26. This tool encodes text as a URL component and decodes percent-encoded strings back to readable text as you type.
https%3A%2F%2Ftoolsapp.work%2Fsearch%3Fq%3Dmortgage%20%26%20loan%26sort%3Dpopular
How to use the URL Encoder
- Choose Encode or Decode.
- Paste the text or URL in the Input box.
- The result updates as you type. A broken % sequence shows a clear error.
- Press Copy to put the result on your clipboard.
Formula
Encode: encodeURIComponent(text) · Decode: decodeURIComponent(text)Every character except A-Z, a-z, 0-9 and - _ . ! ~ * ' ( ) is converted to its UTF-8 bytes, each written as %XX in hexadecimal. This is the right encoding for a query parameter value or a single path segment.
Common encodings
- Space: %20
- &: %26
- =: %3D
- ?: %3F
- /: %2F
- #: %23
- +: %2B
- é: %C3%A9
Component or whole URL
Encoding a component, such as a search term, escapes reserved characters like /, ? and & so they are treated as data. Encoding a whole URL instead keeps those characters so the address stays usable. To build a link, encode each parameter value separately and then join them.
URL Encoder questions
Why do spaces become %20?
URLs cannot contain spaces, so they are percent-encoded as %20, the hexadecimal code for a space. Characters outside plain ASCII are first converted to UTF-8 bytes, so é becomes %C3%A9. In HTML form submissions you may also see a space written as +.
What is the difference between encodeURI and encodeURIComponent?
encodeURI keeps characters that give a URL its structure, such as : / ? # & =, so a whole address stays valid. encodeURIComponent encodes those too, which is what you want for a single parameter value. This tool uses component encoding.
When do I need to URL-encode text?
Encode any value you put into a query string or path, especially user input, search terms, email addresses and other URLs. Without encoding, characters like &, = and # would be read as URL structure and break the link or change its meaning.
Is URL encoding the same as HTML encoding?
No. URL encoding uses percent notation, such as %20 for a space, so text is safe inside a URL. HTML encoding uses entities, such as & for an ampersand, so text displays safely inside a web page. They solve different problems and are not interchangeable.
Why does decoding fail with an error?
Decoding fails when a % is not followed by two hexadecimal digits, or when the bytes do not form valid UTF-8. A common cause is a literal % sign in the text, which should itself be encoded as %25. Fix the stray % and decoding will succeed.
Is it safe to encode the same text twice?
Double encoding changes the result: %20 becomes %2520, and the server then sees the literal text %20 instead of a space. Encode each value exactly once, at the point where you build the URL. If you receive text that has already been encoded, decode it once before encoding it again. Double-encoded values are a common cause of broken links and search parameters that do not match on the server.