How this calculator works
- Step 1Text to bytesUTF-8₹ is three bytes.
- Step 2Keep safe charactersA–Z a–z 0–9 - _ . ~Letters, digits and a few marks pass through unchanged.
- Step 3Escape the rest%XXEvery other byte becomes % and two hex digits.
URLs may only contain a limited set of characters. Anything else, including spaces, ₹ and characters with a special meaning such as & and #, must be percent-encoded.
Worked example: a query value
Encoded as one value, “name=Asha Rao&city=Pune” keeps its = and & from breaking the URL.
- Rule
byte → % + two hex digits
- Space%20 (or + in form data)
- =%3D
- &%26
- As one valuename%3DAsha%20Rao%26city%3DPune
- As form dataname%3DAsha+Rao%26city%3DPune
As a whole URL the same text stays name=Asha%20Rao&city=Pune, because = and & are allowed to keep their meaning there.
Reading the result
- One valueencodeURIComponentFor a query value or one path part. Encodes & = / ? # too.
- Whole URLencodeURIFor a full address. Leaves the characters that structure a URL.
A pasted full URL is also split into parts. For example, https://example.com/search?q=chai%20latte has the query value “chai latte”.
- UTF-8Indian scripts and emoji are encoded byte by byte.
- + means spaceOnly in form data and query strings sent by forms.
- Bad escapesA % without two hex digits is reported with its position.
- Not encryptionAnyone can decode it.
Related encoding tools
Percent-encoding makes text safe in a URL. Other encodings serve other channels.
For binary data as text, use the Base64 encoder and decoder. The slug generator makes readable URL paths, and the QR code generator turns a link into a code.
Common mistakes
Mistake: Encoding a whole URL as one value.
Instead: Encode each value, then build the URL around them.
Mistake: Encoding twice, so % becomes %25.
Instead: Encode once, at the point where you build the URL.
Mistake: Treating + as a plus sign in query strings.
Instead: Encode a real plus as %2B.
Read how we test our calculators, or browse more developer tools.