What Is URL Encoding?
URL encoding, also called percent-encoding, replaces characters that have a special meaning in a URL with a percent sign and two hex digits. For example, a space becomes %20 and an ampersand becomes %26. Encode a value before you put it in a query string, so characters such as &, =, and / do not break the URL.
Encode uses encodeURIComponent, which encodes every reserved character. Decode reverses it and also reads + as a space, as HTML forms send it. Your text never leaves the page.