Security & Crypto

URL Encoder Decoder

Encode or decode URL components, including spaces and Unicode.

encodeURI leaves / ? & alone; this tool uses encodeURIComponent, which encodes them.

Results appear here.

What the result means

This page encodes or decodes one component with encodeURIComponent and decodeURIComponent. Spaces, Unicode, and reserved characters become percent sequences, which is what you want for a query value or a single path segment. Slash, question mark, and ampersand are encoded too. The other built-in, encodeURI, would have left those three alone because it expects a whole address. Decoding turns percent sequences back into characters. A percent sign must be followed by two hexadecimal digits, and if it is not, the browser raises an error whose message is shown as-is. Plus signs stay plus signs. They are not treated as spaces, and a space is written as %20. Nothing is uploaded.

Related tools

Advertisement

Questions

Encode or encodeURIComponent?

Use this page when the text is a single component, such as a query value. It calls encodeURIComponent, which encodes slash, question mark, ampersand, and equals so they cannot act as separators. encodeURI is the other built-in and leaves those characters alone because it expects a whole address. The line under the form names the function this tool calls.

Why did % show an error?

A percent sign starts a two-digit hexadecimal byte during decoding. A lone percent, a single following digit, or a character that is not hexadecimal is malformed, and the browser throws a URIError. The text you see is that error message. Encoding does not emit a broken percent sequence.

Will a space become a plus sign?

No. A space is encoded as %20, not as a plus. Some older form bodies use plus for a space, and this page neither writes nor reads that convention. An existing plus sign stays a plus sign when you decode.