Space encoding:

Input — plain text to encode

Output — encoded result

All encoding is done in your browser. No data is sent to any server.

How URL Encoding Works

URLs can only contain a limited set of safe ASCII characters. When a URL includes characters outside that set — like spaces, ampersands, equals signs, or non-Latin characters — those characters must be replaced with a percent sign followed by two hexadecimal digits. This process is called percent-encoding or URL encoding.

For example, a space character has an ASCII value of 32, which is 20 in hexadecimal, so it becomes %20 in a URL. An at sign @ becomes %40. A forward slash inside a query string becomes %2F.

Worked Example

Suppose you're building a search URL and the query is: hello world & more. After URL encoding, it becomes:

Before encoding

Input:hello world & more

After encoding (%20 mode)

Output:hello%20world%20%26%20more

After encoding (+ mode)

Output:hello+world+%26+more

%20 vs + for Spaces

There are two ways spaces are encoded in URLs, and which one to use depends on context. Use %20 for spaces in URL paths — for example, a filename like my%20file.pdf. Use + for spaces in HTML form data submitted via application/x-www-form-urlencoded (the default form encoding). Both are valid, but mixing them up can cause parsing errors on the receiving server. When encoding credentials or tokens, you may also need our Base64 Encoder — HTTP Basic Authentication uses Base64, not URL encoding, for credentials.

When You Need URL Encoding

URL encoding is necessary any time you pass user-generated text in a URL — search queries, form submissions, API parameters, redirect targets, and email links with pre-filled values. Without it, special characters can break the URL structure and either cause errors or silently corrupt the data being passed. If you're working with JSON API responses, our JSON Formatter can help you read and validate the data before constructing your URL parameters.


Frequently Asked Questions

What is URL encoding and why is it needed?
URL encoding (also called percent-encoding) converts characters that aren't allowed in a URL into a safe format — a percent sign followed by two hex digits. It's needed because URLs can only contain certain ASCII characters. Spaces, ampersands, equals signs, and non-English characters must be encoded before being placed in a URL or query string, otherwise browsers and servers may misinterpret them.
What's the difference between %20 and + for spaces?
Both represent a space, but in different contexts. %20 is the standard percent-encoding for a space and works everywhere in a URL — paths, query strings, and headers. The + sign only represents a space in application/x-www-form-urlencoded data (HTML form submissions). If you're building an API request or constructing a URL by hand, use %20. If you're encoding form data to POST, either works, but + is the traditional convention.
Which characters get percent-encoded?
Any character that is not an unreserved character gets encoded. Unreserved characters — letters (A–Z, a–z), digits (0–9), and the symbols - _ . ~ — pass through unchanged. Everything else, including spaces, @ # $ & + / ? =, and all non-ASCII characters like accented letters or emoji, gets encoded.
How do I decode a URL that contains percent-encoded characters?
Switch this tool to Decode mode, paste the encoded URL or string, and the decoded result appears instantly. In JavaScript, you can use decodeURIComponent() to decode a query string value, or decodeURI() to decode a full URL without touching the structural characters like / and ?.
Is URL encoding the same as Base64 encoding?
No — they're completely different. URL encoding replaces unsafe characters with %XX sequences and keeps the text mostly readable. Base64 encoding converts binary data into a 64-character alphabet (A–Z, a–z, 0–9, +, /) and produces output that looks nothing like the original. URL encoding is used in URLs and query strings. Base64 is used for embedding binary data in text formats like JSON, XML, email attachments, and JWTs.