/ developer & network toolbox
← all tools

$ urlenc

runs locally

URL Encode / Decode

Percent-encode or decode text, in component or full-URL mode. Nothing leaves the page.

url — invoker.tools

Component mode escapes & / ? #; full-URL mode keeps them. Runs locally.

About the URL Encode / Decode

This tool percent-encodes or decodes text for safe use in URLs, with a toggle between encode and decode and a second toggle between component mode (encodeURIComponent / decodeURIComponent) and full-URL mode (encodeURI / decodeURI).

URLs only allow a limited set of characters. Spaces, ampersands, slashes, question marks and non-ASCII characters all need to be escaped as percent sequences, a space becomes %20, before they can safely sit inside a query string, a path segment, or a complete link. This tool does that escaping and unescaping instantly instead of you computing percent codes by hand.

It runs entirely in your browser and is UTF-8 safe, so accented characters and emoji round-trip correctly, and nothing you paste is uploaded anywhere. The real value is in picking the right mode for the job: component mode for a single value, full-URL mode for something that is already a whole URL, a distinction covered in detail below because getting it backwards is the most common way people break a link.

How to use it

  1. Choose encode or decode.
  2. Pick component mode for a single value, or full-URL mode for a complete URL.
  3. Paste your text into the input box.
  4. Click the encode or decode button to run the conversion.
  5. Read the escaped or unescaped result.
  6. Copy the result with one click.

Examples

  • Encode hello world & co in component mode to get hello%20world%20%26%20co.
  • Decode a query-string value like caf%C3%A9 back into café.
  • Encode a search term before appending it to a query string as ?q=....
  • Run https://example.com/path?a=1&b=2 through full-URL mode and see the & and ? left untouched while a space would still be escaped.
  • Decode a malformed percent sequence and see the invalid percent-encoding error rather than silently mangled output.
  • Encode a filename containing spaces and brackets before using it as a path segment in a URL.

Component mode vs full-URL mode

Component mode assumes your input is a single value, a query parameter, a path segment, a form field, so it escapes reserved delimiter characters like & / ? # : that would otherwise be misread as URL structure. Full-URL mode assumes the input is already a complete URL, so it leaves those same delimiters alone and only escapes characters that are never legal anywhere in a URL, such as spaces and raw non-ASCII characters.

  • Component mode (encodeURIComponent / decodeURIComponent): escapes & / ? # : and similar delimiters. Use for a single query value, path segment, or form field.
  • Full-URL mode (encodeURI / decodeURI): leaves delimiters like & / ? # intact so a complete URL keeps working. Use for a whole link, not a fragment of one.
  • Picking the wrong mode is the most common mistake: running a full URL through component mode escapes its own slashes and question mark, breaking the link.

Percent-encoding reference

A percent sequence, %XX, represents one byte of a character's UTF-8 encoding written in hexadecimal. ASCII characters that need escaping become a single %XX; non-ASCII characters expand into several, one per UTF-8 byte.

  • Space becomes %20 with encodeURIComponent / encodeURI; the classic + for a space belongs to application/x-www-form-urlencoded form bodies, a different convention this tool does not produce
  • & becomes %26, ? becomes %3F, # becomes %23, / becomes %2F (component mode only, full-URL mode leaves these alone)
  • Non-ASCII characters such as é or an emoji become multiple %XX bytes, one per UTF-8 byte, not one code per character

Common errors and edge cases

Decode errors here almost always come from a percent sequence that is not well-formed, rather than from the tool. It is worth knowing exactly what shape breaks and why, since the failure mode is an outright error rather than corrupted output.

  • "invalid percent-encoding" error: a % not followed by exactly two hex digits, typically from copying a truncated or already-corrupted string
  • A truncated multi-byte UTF-8 sequence decodes to an error instead of a mangled character, since decodeURIComponent validates the byte sequence
  • This tool does not convert a + into a space on decode; that convention belongs to form encoding, not encodeURIComponent, so a literal + stays a +

Frequently asked questions

What is the difference between component and full-URL mode?

Component mode (encodeURIComponent) escapes reserved characters such as & / ? # :, use it for a single query value or path segment. Full-URL mode (encodeURI) preserves those delimiters so a complete URL keeps working.

Why does a space become %20?

Spaces are not allowed in URLs, so they are percent-encoded. %20 is the encoded form of a space; a + is sometimes used instead, but only in form-encoded query strings, a different convention.

Does this tool convert + to a space when decoding?

No. It uses decodeURIComponent / decodeURI, which treat + as a literal plus character. The +-means-space convention belongs to application/x-www-form-urlencoded, not standard URI encoding.

Is it UTF-8 safe?

Yes. Non-ASCII characters are encoded as their UTF-8 byte sequences, so emoji and accented characters round-trip correctly.

Does my text get uploaded?

No. Encoding and decoding happen entirely in your browser.

Why do I get an "invalid percent-encoding" error?

A % in the input is not followed by exactly two valid hex digits, or a multi-byte UTF-8 sequence is truncated, often from a copy-paste that cut the string short.

What characters does component mode escape that full-URL mode does not?

Component mode escapes URL-structural delimiters like & / ? # : ; = which full-URL mode deliberately leaves untouched so an existing URL keeps working.

Can I use this to encode a whole URL, not just a query value?

Yes, switch to full-URL mode first. Encoding a complete URL in component mode will also escape its own slashes and delimiters, breaking it.

What is percent-encoding?

It is the mechanism URLs use to represent characters outside their limited allowed set, writing each disallowed byte as a % followed by two hexadecimal digits.

Why did encoding my full URL break its slashes and question mark?

Component mode was used on a whole URL instead of full-URL mode. Component mode escapes structural characters like / and ?, which is correct for a single value but breaks a complete link.

More encode / decode tools