How it works
This tool converts between plain text and percent-encoded format, which is the standard way to safely represent special characters and spaces in URLs. When you encode, unsafe characters are replaced with a percent sign and their hexadecimal ASCII or UTF-8 byte value. When you decode, those percent sequences are converted back to their original characters.
The formula
Encoded = "%" + hex(byte value of character) for each unsafe character; all safe characters pass through unchanged.
Worked example
Let's encode the text: Hello, World! How are you?
Step 1: Identify unsafe characters.
- The comma (,), space, exclamation mark (!), and question mark (?) are unsafe.
- Letters, numbers, and the hyphen are always safe.
Step 2: Replace each unsafe character with %HH (where HH is its hex code).
- Comma = ASCII 44 = hex 2C → %2C
- Space = ASCII 32 = hex 20 → %20
- Exclamation = ASCII 33 = hex 21 → %21
- Question mark = ASCII 63 = hex 3F → %3F
Step 3: Reconstruct the string.
- H → H
- e → e
- l → l
- l → l
- o → o
- , → %2C
- (space) → %20
- W → W
- o → o
- r → r
- l → l
- d → d
- ! → %21
- (space) → %20
- H → H
- o → o
- w → w
- (space) → %20
- a → a
- r → r
- e → e
- (space) → %20
- y → y
- o → o
- u → u
- ? → %3F
Result: Hello%2C%20World%21%20How%20are%20you%3F
To decode it, you'd reverse the process: every %HH becomes its corresponding character, and everything else stays as-is.
Non-ASCII example: If you encode café, the é (U+00E9) is UTF-8 encoded as bytes C3 A9, becoming caf%C3%A9.
Common mistakes
Forgetting the forward slash: In URL paths, the forward slash (/) is often safe and shouldn't be encoded—encoding it to %2F breaks navigation. This calculator preserves / by default in most contexts, but check your specific use case.
Double-encoding: If you encode text that's already encoded, you'll get %252C instead of %2C (the % itself gets encoded). Only encode once.
Assuming all symbols are encoded: The hyphen (-), underscore (_), period (.), and tilde (~) don't need encoding and won't be touched. Only unsafe characters are converted.
Mismatched character sets: If the source text uses a different encoding (like Latin-1 instead of UTF-8), decoding may produce garbled output. Always verify the original encoding matches UTF-8.