πŸ”—

URL Encoder / Decoder

Percent-encode and decode URLs with encodeURIComponent or encodeURI. Parse and build query strings, analyze full URL components, and batch-encode multiple URLs β€” all free and private.

Encode & DecodeQuery String ParserURL AnalyzerBatch ModeFree & Private

Encodes all special characters except: A–Z a–z 0–9 - _ . ! ~ * ' ( )

encodeURIComponent vs encodeURI β€” Quick Guide

encodeURIComponent

Use for: Encoding individual values β€” query parameters, path segments

Preserves: A–Z a–z 0–9 - _ . ! ~ * ' ( )

Encodes: Everything else, including : / ? # @ & = + , $

encodeURIComponent("hello world") β†’ "hello%20world"

encodeURI

Use for: Encoding a complete URL without breaking its structure

Preserves: All encodeURIComponent safe chars plus : / ? # [ ] @ ! $ & ' ( ) * + , ; =

Encodes: Spaces, non-ASCII characters, and a few others

encodeURI("https://x.com/hello world") β†’ "https://x.com/hello%20world"

Common URL Encoding Characters

CharacterEncodedDescription
%20Space
!%21Exclamation mark
"%22Double quote
#%23Hash / anchor
$%24Dollar sign
%%25Percent sign
&%26Ampersand
'%27Single quote
(%28Open parenthesis
)%29Close parenthesis
*%2AAsterisk
+%2BPlus sign
,%2CComma
/%2FForward slash
:%3AColon
;%3BSemicolon
=%3DEquals sign
?%3FQuestion mark
@%40At sign
[%5BOpen bracket
]%5DClose bracket
{%7BOpen brace
}%7DClose brace
|%7CPipe
\%5CBackslash
^%5ECaret
`%60Backtick
~%7ETilde (safe in encodeURIComponent)

When to Use URL Encoding

πŸ”

Search Parameters

Encode user search queries before appending to a URL: ?q=hello%20world instead of ?q=hello world.

🌐

Internationalized URLs

Encode non-ASCII characters (accents, CJK, Arabic) so they are valid in URLs: cafΓ© β†’ caf%C3%A9.

πŸ”—

Redirects & Callbacks

Encode redirect URLs passed as query values so the embedded & and ? don't confuse the outer URL parser.

πŸ“‘

API Requests

Encode dynamic values in API endpoints to prevent injection and ensure correct routing.

πŸ“‹

Form Submission

HTML forms use application/x-www-form-urlencoded by default β€” spaces become + and special chars become %XX.

πŸ›‘οΈ

Security

Proper URL encoding prevents open redirect attacks and stops malicious characters from being misinterpreted.

Frequently Asked Questions

What is URL encoding (percent encoding)?+

URL encoding converts characters that are not allowed or have special meaning in a URL into a % followed by two hexadecimal digits. For example, a space becomes %20 and & becomes %26. This ensures the URL is valid and can be transmitted safely over the internet.

What is the difference between encodeURIComponent and encodeURI?+

encodeURIComponent encodes almost all special characters including :, /, ?, #, and @, making it ideal for encoding individual query-string values or path segments. encodeURI preserves those structural characters because it expects a full URL β€” use it to encode a complete URL without breaking its structure.

What does %20 mean in a URL?+

%20 is the percent-encoded representation of a space character (ASCII code 32, hex 20). Because spaces are not allowed in URLs, they must be encoded. Some systems use + instead of %20 in query strings (application/x-www-form-urlencoded), but %20 is correct for path segments and is universally understood.

Which characters are safe in a URL without encoding?+

RFC 3986 defines unreserved characters that never need encoding: uppercase and lowercase letters (A–Z, a–z), digits (0–9), hyphen (-), underscore (_), period (.), and tilde (~). All other characters should be percent-encoded when used in a URL path or query string.

What is a query string and how is it encoded?+

A query string is the part of a URL after the ? character, containing key=value pairs separated by &. Each key and value should be encoded with encodeURIComponent to ensure special characters like &, =, and + don't break the structure. This tool's Query String tab builds or parses these automatically.

Why does my decoded URL show garbled text?+

This usually happens when non-UTF-8 percent-encoded sequences are decoded as UTF-8. Older systems sometimes use Latin-1 or other encodings. Try decoding with a different encoding assumption, or check the original encoding of the source. All modern systems should use UTF-8 for URL encoding.

What is the difference between URL encoding and Base64?+

URL encoding (percent encoding) replaces unsafe characters with % + hex codes and is specifically designed for URLs. Base64 encodes arbitrary binary data as alphanumeric text and is used for embedding binary data in text formats like JSON or HTML. They serve different purposes β€” use URL encoding for URLs and Base64 for binary data.

Can I use this tool for batch encoding multiple URLs?+

Yes β€” switch to the Batch tab, paste one URL or string per line, choose an operation, and every entry is encoded or decoded simultaneously. The results table shows the original and transformed values side by side, and you can copy all results with one click.

More Developer Tools

Everything you need for working with text and data β€” all free, all instant.

Learn more in the MDN documentation for encodeURIComponent and RFC 3986 (URI Generic Syntax).