oktools

URL Encoder & Decoder

Percent-encode text for a query string or path segment (urlencode) and decode URL-encoded strings back to readable text. Encode a single component or a whole URL, choose strict RFC 3986, and decode form-encoded values where + means a space. Everything runs in your browser.

Mode:
Encode as:

Component encodes everything but letters, digits and - _ . ~ ! ' ( ) *, like encodeURIComponent.

0

0

Frequently asked questions

What is URL encoding?

URL encoding, or percent-encoding, replaces characters that have a reserved meaning in a URL with a percent sign and their hexadecimal byte value — a space becomes %20, an ampersand %26. It is what lets a value containing & or ? travel inside a query string without being mistaken for the URL’s own punctuation.

Which characters have to be encoded?

Everything outside the unreserved set of A-Z, a-z, 0-9 and - _ . ~ may need encoding, and the reserved characters : / ? # [ ] @ $ & + , ; = do whenever they appear inside a value rather than as URL structure. Five more are reserved by RFC 3986 but left alone by JavaScript’s encodeURIComponent: ! ' ( ) *. Most servers accept them raw, so they are left alone here too unless you tick Strict RFC 3986, which encodes them the way PHP’s rawurlencode and Python’s quote(safe="") do. Non-ASCII characters are encoded as their UTF-8 bytes, which is why a single accented letter becomes two percent groups.

Should I encode the whole URL or just one parameter?

Usually just the value. The Component mode works like encodeURIComponent — right for a single query parameter or path segment, which is what you almost always have. Encoding a complete address that way turns its slashes and colons into %2F and %3A and produces something no server will route. For a whole URL pick Whole URL, which works like encodeURI: it encodes spaces and non-ASCII characters but keeps : / ? # & = and the rest of the structure intact.

Why is a space sometimes %20 and sometimes a plus sign?

Both appear, in different places. Percent-encoding proper uses %20, and that is what you get here. The plus sign comes from HTML form submission, where application/x-www-form-urlencoded writes a space as +. A decoder has to know which convention produced the text, since a literal plus in a form-encoded value is itself written %2B. Tick "Form-encoded (+ means space)" when decoding a query string that came from a form.

Why does my decoded text come out as gibberish or fail?

Two usual causes: the text was encoded twice, so you need to decode it again — a %2520 is an encoded %20 — or it contains a stray percent sign that is not part of a valid group, which makes the whole string invalid. The error here tells you the position of the first bad escape. Double encoding is the common one and shows up as visible %25 sequences.

Is the text I encode sent anywhere?

No. The whole tool is JavaScript running in your own browser, so nothing you type or paste is sent over the network, written to a log or attached to an analytics event. You can confirm it by opening the network tab and watching it stay empty while you work.