Choose language

URL Encode

Percent-encode text for safe use in URLs and query strings. Escapes spaces and reserved characters, handles UTF-8, and runs entirely in your browser.

Mehmet Demiray Published Updated
Share
Component encodes reserved characters; full keeps the URL structure

What URL Encoding Solves

A URL can only contain a limited set of characters safely. Spaces, accented letters, and symbols like &, ?, and # either have special meaning in a web address or are not allowed at all. URL encoding, also called percent-encoding, replaces those characters with a % followed by their byte value in hexadecimal.

The most familiar example is the space, which becomes %20. So hello world turns into hello%20world, a string that survives intact inside a link or query parameter.

The rules come from the URI standard. Unreserved characters such as letters, digits, -, _, ., and ~ pass through untouched. Everything else that could be misread is escaped. This keeps the structure of a URL unambiguous, so a server knows where a value starts and ends. Without encoding, a stray & inside a search term could be mistaken for the start of a new parameter, quietly breaking the request. To reverse the process and read an encoded value, use URL Decode.

Reserved and Unreserved Characters

Not every character needs encoding, and knowing which is which helps you read URLs at a glance. Unreserved characters are always safe and never escaped. Reserved characters carry structural meaning and are encoded when used as data rather than as delimiters.

The table shows common characters and their encoded form:

Character Encoded Role
space %20 not allowed raw
& %26 separates parameters
? %3F starts query string
= %3D assigns a value
/ %2F path separator

The key idea is context. A / between path segments stays as is, but a / inside a value must become %2F so the server does not read it as a new segment. When you encode a complete value before placing it in a URL, every reserved character inside it is escaped, which keeps your data from breaking the surrounding structure. That single habit, encoding the value rather than the whole link, prevents most of the broken URLs you run into in practice.

Encoding Whole URLs Versus Components

A common mistake is encoding an entire URL when you only meant to encode one value. If you percent-encode a full address, the : after https and the / in the path get escaped too, producing a string that is no longer a usable link.

The right approach is to encode each component separately before assembling the URL. Take a search term like coffee & tea, encode it to coffee%20%26%20tea, and then drop it into the query string: ?q=coffee%20%26%20tea. The ? and = that define the structure stay unencoded because you added them yourself after encoding the value.

This component-level approach is why most programming languages offer two functions, one for encoding a single value and one that leaves structural characters alone. When you need a token-style string instead of percent-encoding, the Base64 encoder handles Base64, which serves a different transport purpose. Matching the function to the task is the whole skill here, since encoding one value at the moment you build the URL avoids almost every structural bug.

Handling Non-ASCII Text

Letters outside the basic ASCII range, such as é, ü, or any non-Latin script, cannot appear directly in a URL. The standard handles them by first converting the character to its UTF-8 bytes, then percent-encoding each byte. This tool follows that rule, so international text encodes correctly.

That is why a single accented character often becomes more than one percent sequence. The letter é is two bytes in UTF-8, so it encodes to %C3%A9. A character from a script like Japanese can take three bytes and produce three percent groups.

This behavior keeps URLs portable across systems and languages. A link with encoded UTF-8 works the same whether it is opened in a browser configured for one region or another. When that same data needs to ride inside a QR code rather than a typed link, URL QR Code Generator can turn a finished URL into a scannable image.

Avoiding Double Encoding

One subtle bug is encoding a value that was already encoded. Because % itself is a special character, it gets escaped to %25 on a second pass. So %20 becomes %2520, and the server then decodes it only once, leaving a literal %20 in your data instead of a space.

The sign of double encoding is %25 showing up where you expected a normal sequence. If you see %2520 in a URL, a value was encoded twice somewhere in the chain.

A few habits prevent it:

  • Encode each value exactly once, at the point you build the URL
  • Do not encode a string that already contains % sequences
  • If you are unsure whether a value is encoded, decode it first with URL Decode and check

Because this tool runs in your browser, you can safely test encoding on sensitive query values without sending them anywhere. That makes it easy to confirm a value encodes cleanly before it goes into a real request, so double encoding never reaches production.

The ones we answer the most.

Why does a space become %20?

Spaces are not allowed directly inside a URL, so they must be escaped. Percent-encoding replaces a space with %20, where 20 is the hexadecimal byte value of the space character. Some contexts use + for spaces inside query strings, but %20 is the safe general form.

Should I encode my whole URL or just parts of it?

Encode individual values, not the entire URL. If you encode the whole address, structural characters like : and / get escaped and the link breaks. Encode each value first, then assemble it into the URL so the ?, &, and = that define the structure stay intact.

Why did one accented letter become several percent codes?

Non-ASCII characters are converted to UTF-8 bytes before encoding, and many of them use more than one byte. The letter é is two bytes, so it becomes %C3%A9. Characters from other scripts can take three bytes and produce three percent groups.

What does %2520 mean when I see it?

It is a sign of double encoding. The % in an already-encoded sequence got escaped to %25, turning %20 into %2520. Encode each value only once. If a value already contains percent sequences, decode it with URL Decode before encoding again.

Is URL encoding the same as Base64?

No. URL encoding escapes unsafe characters for web addresses using % sequences, while Base64 converts binary data into a compact text alphabet for transport. They solve different problems. For Base64, use Base64 Encode instead.

How do I read an encoded URL back?

Paste it into URL Decode, which reverses percent-encoding and returns the original readable text, including spaces and special characters. The two tools are exact inverses for standard percent-encoded values.