How to Encode and Decode URLs
Published August 9, 2026 · 3 min read
URLs can only safely contain a limited set of characters. A space, an ampersand, or a letter with an accent can all break a link or get misread. Encoding fixes that by replacing them with a percent sign and a code.
What URL encoding does
Encoding converts a character into % followed by its hex value, so a
space becomes %20 and an ampersand becomes %26. The text
still means the same thing, it's just written in a form that any URL can carry
safely.
When you actually need it
- Putting a search query or free text into a query parameter.
- Passing a full URL as the value of another URL's parameter, such as a redirect target.
- Sending text with symbols, spaces, or non-English characters through a link.
How to encode or decode text
- Paste the text into the URL encoder and decoder.
- Click Encode to make it URL-safe, or Decode to reverse an already-encoded value.
- Copy the result.
There's also an option to encode a full URL instead of a single value, which keeps
characters like :, /, and ? untouched since
they define the URL's structure.
Why decoding sometimes fails
Decoding breaks when the text contains a % that isn't followed by a
valid two-digit code, which usually means the text wasn't actually URL-encoded to
begin with, or got cut off partway through.
Related articles
How to Shorten a Long URL
Learn why long URLs can be difficult to share and how a URL shortener can turn them into shorter, cleaner links.
Read More →How to Format JSON Online
Learn how to turn messy, minified JSON into readable, indented text, and catch syntax errors along the way.
Read More →How to Create an SEO-Friendly URL Slug
Learn what makes a good URL slug and how to turn a title into a clean, readable, lowercase web address.
Read More →