Skip to main content
Tools Star Hub

Developer Tools

How to Percent-Encode a URL Value

By Tools Star Hub Editorial Team · Published

Percent-encoding writes characters that are not safe in a URL component as a percent sign plus two hex digits. This page uses encodeURIComponent, which escapes the space, ampersand, question mark, and slash in the value you paste. Decode reverses that.

It is not encryption. Anyone can decode the result. A half-finished sequence is rejected instead of guessed.

How to encode or decode

  1. Paste the value or the encoded string. Encode starts from text you want in a query value. Decode starts from a percent-encoded string.
  2. Press Encode or Decode. Spaces become %20. An ampersand becomes %26. Accented letters and other scripts are encoded as UTF-8 percent sequences and can be decoded back.
  3. Stop if decode fails. A cut-off sequence such as %E0%A4%A is rejected. An empty string decodes to an empty string.
  4. Copy the component. This page does not build the rest of the URL. The UTM Builder adds campaign parameters. The URL Parser splits a full address into its parts.
How to Percent-Encode a URL Value — Tools Star Hub

Example

A space and an ampersand

The text a b&c encodes to a%20b%26c.

FAQ

Why are the question mark and slash encoded?
encodeURIComponent treats them as part of the value, not as URL structure. That is stricter than encodeURI.
Is the result secret?
No. Percent-encoding only changes how characters are written.
Why did decode fail?
The percent sequence is incomplete or not valid UTF-8. The page does not fill in the missing digits.
What if I encode nothing?
An empty string stays empty.

To encode or decode one URL component, use the URL Encoder.