One Calculator Logo One Calculator
Everyday Tools • Formulas shown

URL Encode and Decode

Quick Answer

URL encoding replaces unsafe characters with a percent sign and two hex digits. A space becomes %20, & becomes %26 and = becomes %3D, so “a b&c=d” encodes to a%20b%26c%3Dd. Letters, digits and - _ . ~ stay unchanged.

Result

Encoded: https%3A%2F%2Fexample.com%2Fsearch%3Fq%3Dcaf%C3%A9%20%26%20tea

Input length39
Output length62
Step-by-step calculation
  1. Unsafe characters are replaced by % followed by their UTF-8 bytes in hexadecimal, for example space → %20 and é → %C3%A9.

Use “query value” for pieces that go after ? or =, and “whole URL” for a complete address.

About the URL Encode and Decode

Paste text and choose encode or decode. Encoding is needed when a value inside a URL contains spaces, symbols or non-English characters that would otherwise break the link.

This tool encodes a single value, as encodeURIComponent does. Do not encode a whole URL, or the slashes and colons will be escaped too.

How to Use the URL Encode and Decode

  1. Choose encode or decode.
  2. Paste your text.
  3. Copy the result.

Formula and Method

Percent encoding

byte → % + two hex digits

Non-ASCII characters are encoded as UTF-8 bytes first.

Worked Example

Encoding a query value

Input: a b&c=d

  • Space → %20
  • & → %26
  • = → %3D

Result: a%20b%26c%3Dd

Frequently Asked Questions

Why is a space %20 and sometimes +?

Form submissions use + for spaces. Elsewhere in a URL it is %20.

Which characters are safe?

A–Z, a–z, 0–9 and - _ . ~

What is percent-encoding?

The official name, defined in RFC 3986.

Related Calculators

All Everyday & Other Calculators →

Sources and Further Reading

Accuracy and Scope

Results follow the formulas and scales stated on each page. Institutions, vehicles and circuits differ, so check against your own rules and equipment. See our full disclaimer.