URL Encoder & Decoder
Encode URLs, query parameters, and special characters into percent-encoded text, or decode encoded URLs back into a readable form. Processing happens directly in your browser. All processing happens locally in your browser.
Percent-encode or decode text
Uses the browser's native URI-component functions. It transforms text without opening or requesting the URL.
What is URL encoding?
URL encoding, also called percent encoding, converts characters into a form that can be safely used inside parts of a URL. Encoded characters are represented by a % followed by hexadecimal values.
For example:
hello worldbecomeshello%20worldcoffee & teabecomescoffee%20%26%20teaemail@example.combecomesemail%40example.com
Some characters such as /, ?, &, and = already have special roles in a URL. They may need encoding when they are part of a value rather than part of the URL structure.
URL encoding is commonly used for search terms, query parameters, redirect destinations, callback URLs, and API requests. If you want to inspect the protocol, hostname, path, query parameters, and fragment of a URL, use the URL Parser.
How to encode or decode a URL
- Enter your text Paste a URL, query parameter, text value, or percent-encoded string into the input area.
- Choose Encode or Decode Use Encode to convert special characters into percent-encoded values. Use Decode to turn encoded values back into readable text.
- Check the result Review the output before using it in a URL, API request, redirect, or application.
- Copy the output Copy the result to your clipboard, or use it as the next input if you want to reverse the conversion.
URL encoding examples
These examples show what happens when spaces and characters with special URL meanings are used as data:
| Original | Encoded | What changed? |
|---|---|---|
hello world |
hello%20world |
The space becomes %20. |
name=John Smith |
name%3DJohn%20Smith |
The equals sign and space are encoded because they are part of the value. |
coffee & tea |
coffee%20%26%20tea |
The ampersand becomes %26 so it is treated as text instead of a query separator. |
email@example.com |
email%40example.com |
The @ character becomes %40. |
category=men/women |
category%3Dmen%2Fwomen |
The equals sign and slash are encoded when the whole string is treated as one value. |
Encode a value or a full URL?
You usually do not need to encode every character in a complete URL. In many cases, only the dynamic value inside a query parameter needs encoding.
Consider this URL:
https://example.com/search?q=coffee & tea
The intended search value is coffee & tea. However, & already has a special role in a query string because it separates parameters.
Encode the value:
coffee%20%26%20tea
Then place it back into the URL:
https://example.com/search?q=coffee%20%26%20tea
If you instead encode the complete URL as a single component, you may get:
https%3A%2F%2Fexample.com%2Fsearch%3Fq%3Dcoffee%20%26%20tea
That value can be useful when an entire URL needs to be stored inside another parameter, but it is not a directly navigable replacement for the original URL.
Simple rule: When building query strings, encode individual parameter values while keeping the URL structure intact.
Common URL-encoded characters
These are some percent-encoded values you will often see while working with URLs:
| Character | Encoded | Common role |
|---|---|---|
| Space | %20 |
Whitespace inside a value |
! |
%21 |
Literal punctuation |
# |
%23 |
Starts a URL fragment when used structurally |
$ |
%24 |
Literal dollar sign |
& |
%26 |
Separates query parameters when used structurally |
+ |
%2B |
Literal plus sign |
/ |
%2F |
Separates path segments |
: |
%3A |
Used after a URL scheme such as https: |
= |
%3D |
Separates parameter names and values |
? |
%3F |
Starts a query string |
@ |
%40 |
Literal at sign when used as data |
Whether a character needs encoding depends on where it appears. A slash may be intentional in a URL path, for example, but should usually be encoded when it belongs inside a single parameter value.
encodeURI() vs encodeURIComponent()
JavaScript provides two commonly used functions for encoding URLs. The important difference is whether you are encoding a URL structure or one value inside it.
encodeURI()
encodeURI() is useful when you already have a mostly complete URL and want to encode characters such as spaces without escaping its main structural separators.
encodeURI("https://example.com/search?q=hello world");
// "https://example.com/search?q=hello%20world"
Characters such as /, :, ?, &, and = remain available to define the URL structure.
encodeURIComponent()
encodeURIComponent() is usually the better choice for an individual query parameter value.
encodeURIComponent("coffee & tea");
// "coffee%20%26%20tea"
Here the ampersand is encoded because it belongs to the value instead of acting as a separator between query parameters.
Tip: If you are inserting user-entered text into a query parameter, encodeURIComponent() is usually the function you want.
Common URL encoding mistakes
-
Encoding more than necessary:
Encoding a complete URL with a component encoder also converts characters such as
/,?, and=. Encode the dynamic value when the surrounding URL structure needs to remain readable. -
Encoding the same value twice:
hello worldbecomeshello%20world. If that result is encoded again, it becomeshello%2520worldbecause the existing%is encoded as%25. -
Confusing + with %20:
HTML form encoding commonly uses
+for spaces in query values, while percent encoding represents a space as%20. A literal plus sign can also appear as%2B, so the correct interpretation depends on the context. - Assuming a decoded link is safe: Decoding a URL only makes its contents easier to read. Check unfamiliar domains and destinations before opening them.
When URL encoding is useful (Use cases)
URL encoding is useful whenever text or another URL needs to be placed safely inside part of a web address.
- Search queries: Encode spaces and special characters entered into a search field.
- API requests: Prepare filter values, search terms, and other query parameters before adding them to a request URL.
- Redirect URLs: Encode a destination URL when it needs to be passed as the value of a parameter such as
redirect_uriorreturn_to. - Debugging: Decode URLs from logs or error messages so their query values are easier to inspect.
- Campaign links: Encode UTM campaign names and other tracking values that contain spaces or special characters.
- OAuth callbacks: Encode redirect and callback values without allowing their own query characters to change the surrounding authorization URL.
- Manual inspection: Decode values such as
%20,%2F,%3F, and%26when troubleshooting a URL.
Browser-based processing
Your text is encoded and decoded directly in your browser. TryFormatter does not need to upload the input to its server to perform this conversion.
Privacy tip: Avoid putting passwords, API keys, session tokens, or other secrets inside URLs. URLs can appear in browser history, logs, analytics systems, and other records.
Frequently Asked Questions
What is URL encoding?
URL encoding converts characters into percent-encoded values when they need to be represented safely inside part of a URL. For example, a space is commonly encoded as %20.
What does %20 mean in a URL?
%20 represents a space character in percent encoding.
Should I encode an entire URL?
Usually not. When building a URL, it is often better to encode individual parameter values while leaving structural characters such as slashes, question marks, and parameter separators intact.
What is the difference between URL encoding and Base64?
URL encoding represents characters so they can be used safely inside URL components. Base64 converts text or binary data into a different text representation. They solve different problems. You can use the Base64 Encoder & Decoder when you need Base64 conversion.
Can I decode a percent-encoded URL?
Yes. For example, hello%20world decodes to hello world. Decoding makes encoded text readable again but does not change whether the destination itself is trustworthy.
Does this tool upload my URL?
No. Encoding and decoding are performed locally in your browser.