niftytools.dev
advertisement

URL Encoder / Decoder

Encode special characters in URLs or decode percent-encoded strings back to plain text.

0 characters
0 characters
advertisement
advertisement

What is URL Encoding?

URL encoding (also called percent-encoding) is a method for converting characters that are not allowed in URLs into a safe format that can be transmitted over the internet. URLs can only contain a limited set of ASCII characters. Any other character — spaces, accented letters, symbols, or non-Latin scripts — must be encoded as a percent sign followed by two hexadecimal digits representing the character's byte value. For example, a space becomes%20, and an ampersand becomes%26.

When Do You Need URL Encoding?

  • Query string parameters — When building URLs with user-supplied data (search terms, names, addresses), encode all values to prevent breaking the URL structure.
  • API requests — Many APIs require encoded parameters in request URLs. Unencoded characters like &, =, or ? inside parameter values will corrupt the query string.
  • Form data — HTML forms with method="GET" automatically encode field values, but manual URL construction in code requires explicit encoding.
  • Redirect URIs — OAuth and other authentication flows require the redirect_uri parameter to be percent-encoded since it is itself a URL inside a URL.
  • Debugging — Decode garbled percent-encoded URLs to read their original content and identify malformed requests.

URL Encoding vs. Base64 Encoding

URL encoding and Base64 encoding both convert data into a safe text representation, but they serve different purposes. URL encoding makes individual characters safe for use in a URL by replacing unsafe characters with percent-escaped equivalents — the output is still readable text. Base64 encoding converts arbitrary binary data (including non-text files) into a compact string of 64 safe characters — the output is not human-readable. Use URL encoding for query parameters and path segments; use Base64 for embedding binary data in JSON or HTML.

How to Encode or Decode a URL

  1. Paste the text or URL you want to encode into the input box above.
  2. Choose full-URL encoding (keeps / : ? & = intact) or component encoding (encodes everything) depending on whether you are encoding a whole URL or a single value.
  3. Copy the percent-encoded result — or switch to decode mode to turn a %20-filled string back into readable text.

Frequently Asked Questions

What is the difference between encodeURI and encodeURIComponent?

In JavaScript, encodeURI() encodes a full URL and leaves URL structural characters like / : ? & = intact.encodeURIComponent() encodes a single value and also encodes those structural characters. Use encodeURIComponent() when encoding parameter values so that special characters in the value do not break the URL structure.

Why does a space sometimes appear as + instead of %20?

The + sign as a space representation comes from the older application/x-www-form-urlencoded encoding used in HTML form submissions. In modern URLs and API query strings,%20 is the correct representation of a space per the RFC 3986 standard. Both are widely understood by web servers, but %20 is safer and unambiguous.

Does URL encoding affect SEO?

Google and other search engines decode percent-encoded URLs and handle them correctly, so encoding itself does not hurt SEO. However, URLs with long percent-encoded sequences are harder to read and share. Where possible, use readable ASCII slugs for URL paths (e.g./blog/how-to-encode-urls) and only apply percent-encoding to query parameter values.

How do I encode a query string parameter?

Encode each parameter value individually using component encoding before joining them with&. That way a value containing &,=, or a space cannot break the surrounding query structure. Paste the raw value here, encode it, then drop it in after the=.

Is my data sent to a server when encoding?

No. Encoding and decoding run entirely in your browser using the nativeencodeURIComponent anddecodeURIComponent functions. Nothing you paste is transmitted or stored, so it is safe to use with internal URLs or tokens embedded in query strings.