When you type a search query into Google and look at the address bar afterwards, the URL is full of strange looking sequences like %20, %3F, and %2B. That is URL encoding at work. It is the simple but important system the web uses to make sure any text, in any language, can travel safely inside a web address.
If you have ever wondered why your search for "café" suddenly looks like "caf%C3%A9" in the URL, or why a link broke when you copied it into a message, you are about to understand exactly what is going on.
What Is URL Encoding?
URL encoding, sometimes called percent encoding, is a way to represent characters that are not safe to put directly in a URL. It works by replacing each unsafe character with a percent sign followed by two hex digits that represent the character's code in the ASCII or UTF-8 table.
For example, a space becomes %20. A question mark becomes %3F. An ampersand becomes %26. The letter é becomes %C3%A9 because it is two bytes in UTF-8.
The percent sign is the marker. Whenever a browser or server reads a percent sign in a URL, it knows the next two characters are a code that needs to be turned back into the original character.
Why URLs Cannot Just Carry Any Text
A URL has a very specific structure. It looks like https://example.com/search?query=hello&page=2. Inside that structure, several characters have special meaning. The question mark separates the path from the query string. The ampersand separates one query parameter from the next. The equals sign separates a key from its value. The slash separates parts of the path.
If you wanted to search for the literal text "hello&world", you cannot just write it in the URL. The browser would think the ampersand was a parameter separator and would split the value in the wrong place. To carry that text safely, the ampersand inside the value has to be encoded as %26, producing a URL like https://example.com/search?query=hello%26world. Now the browser knows the ampersand is part of the value, not a separator.
When You Need to URL Encode
You should URL encode any time you build a URL from data that you do not fully control. Common situations include:
Building API requests
When you call an API and pass a search term or filter value in the query string, you must encode that value. If your search term is "stainless steel & black", the ampersand will break the URL unless it is encoded.
Linking from a page to another page
If you build a link in HTML that includes a user generated value in the URL, encode that value. Otherwise names with spaces, plus signs, or symbols will produce broken links.
Sharing complex URLs
When you copy a URL from your browser into a chat message, the URL is already encoded. If you decode it for readability, do not paste the decoded version anywhere that will be used as a real URL.
Power Automate OData and SharePoint filters
When you build OData filter expressions in Power Automate or SharePoint, special characters in the filter value need to be encoded so that the platform parses your query correctly. A single quote inside a value, for example, needs to become %27.
URL Encoding for Components vs Whole URLs
There are two encoding modes you will see in tools and in JavaScript, and they do slightly different things.
Encoding a component is for values that go inside a URL. It encodes everything that has special meaning in a URL, including the slash, question mark, ampersand, equals sign, and hash. Use this mode for query string values, path segments, and anything that is one piece of a URL.
Encoding a whole URL is for full web addresses. It leaves the structural characters alone (the slash, colon, question mark, and ampersand) because those are part of the URL syntax. It only encodes characters that would otherwise be unsafe, like spaces and accented letters.
If you are not sure which one to use, here is a rule of thumb. If you are encoding one value to put inside a URL, use component mode. If you are encoding an entire URL that someone typed by hand, use whole URL mode.
How to Use the DevHexLab URL Encoder
Open the URL Encoder on DevHexLab. Paste the text or URL you want to encode into the input box. Pick the right encoding mode for your situation. Component mode encodes everything that has meaning in a URL. Whole URL mode preserves the URL structure. Click Copy to grab the encoded result and paste it into your code, API request, or link.
Everything happens in your browser. Nothing is sent to a server. Your data stays private even when you are encoding sensitive query strings.
Common Mistakes to Avoid
Encoding twice by accident
If you take an already encoded string and encode it again, every percent sign becomes %25. You end up with sequences like %2520 (which is %20 encoded again, where the percent sign was turned into %25). If you see %25 in your URL when you did not expect it, you have probably encoded twice. Decode it once to fix it.
Forgetting to encode plus signs
A plus sign has a special meaning in some URL contexts (it can mean a space). If you have a real plus sign in your data, encode it as %2B to avoid confusion.
Mixing up encoding and HTML encoding
URL encoding turns characters into %XX sequences. HTML encoding turns characters into named entities like & and <. They are not the same. URL encoding goes in URLs. HTML encoding goes inside HTML page content.
Frequently Asked Questions
Is URL encoding the same as Base64 encoding?
No. URL encoding only changes characters that are unsafe in a URL. Most letters and digits pass through unchanged. Base64 transforms every byte of the input into a totally different output. They serve different purposes.
Do I need to encode characters like / and : in a normal URL?
Not when they are doing their normal job in the URL structure. The slashes in https://example.com/path do not need encoding. But if a slash appears inside a value (like a file path inside a query string), encode it.
Can I URL encode emoji?
Yes. Emoji are valid Unicode characters and they encode to a sequence of percent codes representing their UTF-8 bytes. A grinning face becomes %F0%9F%98%80 in URL encoded form.
Do all browsers handle URL encoding the same way?
Yes. URL encoding is defined by RFC 3986 and every modern browser and server follows the same rules.
Start Encoding Safely
URL encoding is one of those quiet, behind the scenes pieces of how the web works that suddenly becomes important the moment your link breaks or your API call returns an unexpected error. Once you understand what it is doing and when to apply it, you can build URLs and integrations that handle any input cleanly. Open the DevHexLab URL Encoder, paste any text you have ever seen break a URL, and watch it turn into something safe to send anywhere.