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.
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
| Character | Encoded | Description | |
|---|---|---|---|
| %20 | Space | ||
| ! | %21 | Exclamation mark | |
| " | %22 | Double quote | |
| # | %23 | Hash / anchor | |
| $ | %24 | Dollar sign | |
| % | %25 | Percent sign | |
| & | %26 | Ampersand | |
| ' | %27 | Single quote | |
| ( | %28 | Open parenthesis | |
| ) | %29 | Close parenthesis | |
| * | %2A | Asterisk | |
| + | %2B | Plus sign | |
| , | %2C | Comma | |
| / | %2F | Forward slash | |
| : | %3A | Colon | |
| ; | %3B | Semicolon | |
| = | %3D | Equals sign | |
| ? | %3F | Question mark | |
| @ | %40 | At sign | |
| [ | %5B | Open bracket | |
| ] | %5D | Close bracket | |
| { | %7B | Open brace | |
| } | %7D | Close brace | |
| | | %7C | Pipe | |
| \ | %5C | Backslash | |
| ^ | %5E | Caret | |
| ` | %60 | Backtick | |
| ~ | %7E | Tilde (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).