SEO URL Tools

URL Encoder and Decoder Online

Encode special characters in URLs to percent encoding. Decode percent-encoded URLs back to readable text. Instant results, 100% client-side.

Strictness:

Raw Text to Encode

Result

What Is URL Encoding?

URL encoding converts characters that are not allowed in URLs into a safe format for transmission over the internet. Also known as percent encoding, it replaces unsafe characters with a percent sign followed by two hexadecimal digits.

When Do You Need to Encode a URL?

You need to encode a URL when it contains spaces, special characters, or non-ASCII characters. Common situations include encoding search query parameters, encoding file names with spaces, encoding form data before submission, and passing URLs as parameter values inside other URLs.

encodeURI vs encodeURIComponent in JavaScript

JavaScript offers two distinct built-in functions for URL encoding. Using the wrong one is a common source of bugs.

encodeURI()

Use this when you want to encode an entire URL. It ignores structural characters like : / ? # & =.

const url = 'https://example.com/search files?q=my query';
console.log(encodeURI(url));
// https://example.com/search%20files?q=my%20query

encodeURIComponent()

Use this when encoding the value of a query parameter. It encodes everything, including structural characters, ensuring they don't break the parent URL.

const param = 'https://google.com?q=test';
console.log('https://example.com/redirect?url=' + encodeURIComponent(param));
// https://example.com/redirect?url=https%3A%2F%2Fgoogle.com%3Fq%3Dtest

URL Encoding in PHP

PHP has two similar functions for url encoding: urlencode() and rawurlencode().

$query = "hello world";

echo urlencode($query); // hello+world (Historical encoding)
echo rawurlencode($query); // hello%20world (Modern RFC 3986 encoding)

Note: rawurlencode is highly recommended for modern applications as it complies with RFC 3986 by encoding spaces as %20.

URL Encoding in Python

import urllib.parse

url = "https://example.com/search filter"
query_args = {"q": "hello world", "lang": "en"}

# Encode a full URL path component
print(urllib.parse.quote(url))

# Encode a dictionary into a query string
print(urllib.parse.urlencode(query_args)) # q=hello+world&lang=en

Percent Encoding Reference Table

Below is a strict reference list of common characters and their exact percent encoded hexadecimal equivalent.

CharacterDescriptionEncoded Hex
" "Space%20
!Exclamation mark%21
"Double quote%22
#Hash / number sign%23
$Dollar sign%24
%Percent sign%25
&Ampersand%26
'Single quote%27
(Open parenthesis%28
)Close parenthesis%29
+Plus sign%2B
,Comma%2C
/Forward slash%2F
:Colon%3A
;Semicolon%3B
=Equals sign%3D
?Question mark%3F
@At sign%40
[Open bracket%5B
]Close bracket%5D

Frequently Asked Questions

What is URL encoding?

URL encoding (also called percent encoding) converts characters that are not allowed in URLs into a format that can be transmitted. Special characters like spaces, quotes, and ampersands are replaced with a percent sign followed by two hexadecimal digits. For example, a space becomes %20 and an ampersand becomes %26.

What is the difference between encodeURI and encodeURIComponent?

encodeURI encodes a complete URL and preserves structural characters like colons, slashes, question marks, and ampersands. Use it for full URLs. encodeURIComponent encodes a URL component such as a query parameter value and encodes those structural characters too. Use it when encoding individual query string values to prevent them from being interpreted as URL structure.

Why does a space become %20 in a URL?

URLs can only contain a limited set of characters from the ASCII character set. Spaces are not allowed in URLs. When a space appears in a URL, it is encoded as %20, which is the hexadecimal representation of 32, the ASCII code for a space character. In HTML form submissions, spaces are sometimes encoded as plus signs (+) instead.

How do I decode a URL in JavaScript?

Use decodeURIComponent() to decode a URL-encoded string in JavaScript. For example: decodeURIComponent('hello%20world') returns 'hello world'. Use decodeURI() if you want to decode a full URL while keeping structural characters like slashes and question marks encoded.

Local Processing
End-to-End Encryption
Works Offline

Building Something Beyond This Tool?

We help teams design and build reliable web and mobile applications backed by well-structured APIs.