โœฆ Developer Tool ยท Interactive
โ† Back to dev

URL Encoder and Decoder

Encode spaces, ampersands and special characters in URLs, or decode percent-encoded links back to plain text. Handy for UTM tags and API query strings.

{ } Developer Toolโšก Instant result
</>
{ } 01 ยท DEVELOP

When a space or ampersand breaks your link

A campaign link like ?utm_campaign=Diwali Sale & Offers will not survive a click. The space ends the URL in some apps, and the & starts a new parameter. URL encoding, also called percent-encoding, replaces such characters with a % sign and two hex digits.

This URL encoder and decoder converts text to its safe percent-encoded form and back. Paste a messy query value to encode it, or paste a link full of %20 and %2F to read it.

Percent-encoding reference for common characters

CharacterEncodedWhy it needs encoding
Space%20 (or + in form data)Not allowed in URLs
&%26Separates query parameters
=%3DSplits a key from its value
?%3FStarts the query string
/%2FSeparates path segments
#%23Starts a page fragment
%%25Marks an encoded byte
Rs symbol (U+20B9)%E2%82%B9Non-ASCII, sent as 3 UTF-8 bytes

Letters, digits and - _ . ~ never need encoding. These are the "unreserved" characters in RFC 3986.

encodeURI vs encodeURIComponent

JavaScript offers two functions, and picking the wrong one is a classic bug. encodeURI is meant for a full URL. It leaves / ? & = # untouched so the address still works. encodeURIComponent is meant for a single value. It encodes those characters too.

Rule of thumb: build the URL structure yourself, then run each parameter value through encodeURIComponent. Encoding a whole URL with the component version turns https:// into https%3A%2F%2F, which no browser will open.

Watch for double encoding

If you see %2520, the text was encoded twice. The first pass made a space into %20. The second pass encoded the % as %25. Decode once, check the result, and encode only once.

A UTM example

Raw value: Diwali Sale & Offers

Encoded value: Diwali%20Sale%20%26%20Offers

The link then carries utm_campaign=Diwali%20Sale%20%26%20Offers, and your analytics tool reports the full campaign name.

Who needs a URL encoder day to day

  • Digital marketers building UTM links with spaces, brand names or Hindi words in campaign values.
  • Developers passing search terms, redirect URLs or JSON strings as query parameters.
  • SEO teams reading encoded URLs in Search Console or crawl reports.
  • Support staff decoding links pasted by customers to see the real destination.

Developers in other languages have their own helpers. Python offers urllib.parse.quote, PHP has rawurlencode and Java uses URLEncoder.encode. Note that Java's version turns spaces into +, which suits form data more than paths.

For SEO, keep page slugs to lowercase letters, numbers and hyphens. Such slugs need no encoding, read cleanly in search results and are easy to share. Google handles encoded non-English URLs, but plain slugs are simpler to manage.

For a quick check before you publish a tracking link, run the value through the ToolsMate URL encoder. Then test the final link in a private window to confirm it lands where you expect.

</> 02 ยท UNDERSTAND

How this developer tool works

01

Enter the required information

Use the fields in the tool above and keep units and formats consistent.

02

Run the tool

Review the result shown in the output area.

03

Check the assumptions

Confirm that the result matches your situation before using it for a decision.

</> 03 ยท FORMULA / LOGIC

Which formula or logic is used?

</>URL components are encoded with encodeURIComponent.

This describes the core logic used by the tool. Check any assumptions that may affect your result.

โœฆ 04 ยท IMPORTANT

Things to know before using URL Encoder / Decoder

01

Use accurate inputs and keep units consistent.

02

Review the assumptions before using the result for a decision.

03

Compare important results with an independent or official source.

? 05 ยท FAQ

Frequently Asked Questions

Should a space be encoded as %20 or a plus sign?+

Use %20 in URL paths and in most query strings. The plus sign means a space only in form data sent as application/x-www-form-urlencoded. Many servers accept both in queries, but %20 is the safer, more widely understood choice.

Why do I see %2520 in my URL?+

That pattern means the URL was encoded twice. A space first became %20, then the percent sign itself was encoded as %25. Decode the string once and make sure your code applies encoding only a single time.

Which characters do not need URL encoding?+

Uppercase and lowercase letters, digits, hyphen, underscore, full stop and tilde are unreserved, so they never need encoding. Reserved characters such as slash and question mark only need encoding when used as data rather than structure.

Do I need to URL encode UTM parameters?+

Yes, encode each UTM value if it contains spaces, ampersands, hash signs or non-English characters. Otherwise analytics tools may cut the campaign name short or split it into extra parameters, which spoils your reporting data.

Is URL encoding the same as HTML encoding?+

No, they solve different problems. URL encoding uses percent signs for characters in web addresses. HTML encoding uses named entities that start with an ampersand. These let characters display safely inside a page.

How do I URL encode in Python?+

Use urllib.parse.quote for a single value, or urllib.parse.urlencode to build a whole query string from a dictionary. Pass safe='' to quote when you also want slashes encoded, for example inside a redirect parameter.

Can URL encoding handle Hindi or other non-English text?+

Yes, non-ASCII characters are first converted to UTF-8 bytes, and each byte is then percent-encoded. A single Devanagari letter usually becomes three encoded bytes, so encoded Hindi text looks much longer than the original.

โ—Ž 08 ยท CATEGORY HUBS

Explore TheToolsMate