URL Encoder and Decoder

Encode text for a URL component or decode percent-encoded text in your browser.

Short answer: URL encoding (percent-encoding) replaces characters that have a special meaning in a URL with a % sign and their hex code, so a space becomes %20 and an ampersand becomes %26. This tool uses JavaScript's encodeURIComponent to encode a single value and decodeURIComponent to turn an encoded value back into readable text. Encode the values that go inside a URL, not the whole URL.

Your result appears here.

How to use the URL encoder and decoder

  1. Paste text or an encoded value into the Text or encoded value box.
  2. Click Encode to convert readable text into a URL-safe value, for example before placing it after ?q= or ?text=.
  3. Click Decode to turn something like summer%20sale%20%26%20offers back into summer sale & offers.
  4. If the input contains a broken sequence, such as a lone %, the tool shows "Invalid percent-encoded value." instead of guessing.

How percent-encoding works

RFC 3986 defines the "reserved" characters that structure a URL — : / ? # [ ] @ and ! $ & ' ( ) * + , ; = — and the "unreserved" ones that never need encoding: letters, digits and - . _ ~. Anything else, or a reserved character used as data, is written as % followed by its UTF-8 bytes in hex.

According to MDN, encodeURIComponent escapes everything except letters, digits and - _ . ! ~ * ' ( ). Outputs from this tool:

InputEncoded outputWhy
summer sale & offerssummer%20sale%20%26%20offersA space and & would break a query string
Diwali Offer: 20% off!Diwali%20Offer%3A%2020%25%20off!% itself must be encoded; ! is left alone
₹%E2%82%B9Non-ASCII characters become their UTF-8 bytes
नमस्ते%E0%A4%A8%E0%A4%AE%E0%A4%B8%E0%A5%8D%E0%A4%A4%E0%A5%87Each Devanagari character takes three bytes
a+ba%2Bb+ is reserved and can mean a space in form data

Quick reference: characters you will meet most often

CharacterEncodedRole in a URL if left unencoded
space%20Not allowed; breaks the link or gets cut off
&%26Starts a new parameter
=%3DSeparates a parameter name from its value
?%3FStarts the query string
#%23Starts the fragment; everything after it is not sent to the server
/%2FSeparates path segments
%%25Starts an encoded sequence

Worked example — a Bengaluru electronics store. A campaign called "offer#1" pasted raw into ?utm_campaign=offer#1 reaches analytics as just "offer", because everything after # is treated as a fragment. Encoded, it is offer%231 and arrives intact. The UTM builder does this encoding for you, and our UTM parameters guide lists other characters to avoid in campaign names.

encodeURIComponent versus encodeURI

JavaScript has two encoders. encodeURI is meant for a complete address, so it leaves the structural characters : / ? & = # untouched. encodeURIComponent, which this tool uses, is meant for one value and encodes those characters too, so a user-typed & cannot be mistaken for a parameter separator. MDN gives the classic example: a value like "Jack & Jill" breaks a form submission unless it is encoded as a component. Use this tool for values; if you only need to make a full address with spaces valid, encode just the spaces.

Common mistakes and how to fix them

  • Encoding the whole URL. https://example.com/?a=1&b=2 becomes https%3A%2F%2Fexample.com%2F%3Fa%3D1%26b%3D2, which is no longer a working link. Encode only the value, unless you are passing an entire URL as a parameter (for example a redirect target).
  • Double encoding. Encoding %20 again gives %2520, which shows up as a literal "%20" on the page. If you see %25 followed by two hex digits, decode once.
  • Expecting + to decode as a space. decodeURIComponent only decodes % sequences, so summer+sale stays as is. Replace + with a space first when decoding form-style data, such as the output of the email link generator.
  • Decoding a truncated value. A copy that cut a sequence in half (%E0%A4%A) cannot be decoded; copy the full string again.

Practical use cases

  • Marketer: decode a long tracking URL from an ad report to read which campaign and creative it belongs to.
  • Developer: encode a search term or redirect URL before adding it to a query string.
  • WhatsApp or SMS campaigns: encode a Hindi or Tamil message for a prefilled link.
  • SEO audit: decode encoded URLs in crawl reports to spot duplicate pages, as covered in our technical SEO audit checklist.

Everything runs in your browser — nothing you type is sent to our servers.

Frequently asked questions

What is URL encoding?

URL encoding, also called percent-encoding, replaces characters that are not allowed or have a special meaning in a URL with a percent sign and two hexadecimal digits. A space becomes %20, an ampersand %26 and the rupee sign %E2%82%B9. It lets any text travel safely inside a link without breaking its structure.

What does %20 mean in a URL?

%20 is an encoded space. 20 is the hexadecimal code for the space character, so "summer%20sale" reads as "summer sale". In form submissions and some query strings you may see a plus sign used for spaces instead. Paste the value into this tool and click Decode to read it.

Should I encode the whole URL or just part of it?

Encode only the parts that carry data, usually query-parameter values. Encoding a complete URL also encodes the colon, slashes, question mark and ampersands that hold it together, so it stops working as a link. The exception is when a whole URL is itself a parameter value, such as a redirect target.

What is the difference between encodeURI and encodeURIComponent?

encodeURI is meant for a complete URL and leaves structural characters such as : / ? & = and # alone. encodeURIComponent is meant for a single value and encodes those characters too, so a user-entered & cannot be read as a separator. This tool uses encodeURIComponent, the right choice for parameter values.

Why does decoding show an error?

The input contains a percent sign that is not followed by two valid hex digits, or a byte sequence that is not valid UTF-8, for example a stray % or a value cut off mid-character. Check the source, copy the full value again, or encode a literal percent sign as %25.