URL Encode
Percent-encode text for safe use in URLs.
Percent-encode text for URLs. Component, full URI, or form mode. Free, offline, runs in your browser. Read more Show less
What is URL encoding?
URL encoding (also called percent-encoding) replaces characters that are not allowed in a URL with a % followed by two hexadecimal digits. For example, a space becomes %20, and & becomes %26. This makes a string safe to place in a URL path, query string, or fragment.
Component vs. full URI
Component mode (encodeURIComponent) encodes everything except unreserved characters, including /, ?, &, and =. Use this for values inside a query string.
Full URI mode (encodeURI) preserves URL structure characters like /, ?, #, and &. Use this to encode a whole URL.
Form mode (application/x-www-form-urlencoded) encodes spaces as + instead of %20. This is what HTML forms submit.
Frequently asked questions
Which characters are safe in a URL?
Unreserved characters A-Z a-z 0-9 - _ . ~ never need encoding. Everything else should be percent-encoded when it appears outside its structural role.
Why does my space become + or %20?
Both are valid, but they decode differently: %20 is always a space; + is a space only in form-encoded data. When in doubt, use %20 (component mode).