Skip to content
CalcSpectrum

URL Encode/Decode Calculator

Encode or decode a URL component (query value or path segment), with correct Unicode handling and clear rejection of malformed percent-encoding.

Free to use · Instant results
Loading calculator…

How It's Calculated

Formula

\text{output} = \text{encodeURIComponent}(\text{text})

URL component encoding replaces characters that are unsafe or reserved in a URL (spaces, &, =, ?, /, and non-ASCII characters) with a '%' followed by their two-digit hexadecimal byte value, so the text can be safely placed inside a query string value or path segment. This calculator encodes/decodes a URL COMPONENT, matching encodeURIComponent/decodeURIComponent — it does NOT perform whole-URL encoding (encodeURI), which deliberately leaves structural characters like &, =, /, and ? untouched because those are meaningful in a full URL. URL encoding is not encryption: it is fully reversible with no key, and only obscures characters that would otherwise break URL syntax. Malformed percent-encoding (like a stray '%' or '%' not followed by two hex digits) is rejected rather than silently repaired.

Worked Examples

Encode 'hello world'

  1. Space is not URL-safe, so it becomes %20.
  2. Result: hello%20world

Encode 'a&b=c'

  1. & becomes %26, = becomes %3D.
  2. Result: a%26b%3Dc

Frequently Asked Questions

What's the difference between URL component encoding and whole-URL encoding?

Component encoding (used here, equivalent to encodeURIComponent) escapes every reserved character, including &, =, /, and ?, which is correct for a single query value. Whole-URL encoding (encodeURI) leaves those characters alone because they have structural meaning in a full URL. Encoding a full URL with component encoding would break it.

Is URL encoding the same as encryption?

No. URL encoding is fully reversible with no key or secret, and only exists to make text safe to embed in a URL. It provides no confidentiality.

Why does decoding sometimes fail?

Decoding fails when the input contains malformed percent-encoding, such as a '%' at the end of the string or a '%' not followed by two valid hexadecimal digits.

Does this calculator fetch or open the URLs I enter?

No. This calculator only transforms text. It never fetches, opens, or executes any submitted URL or decoded content.