A search box accepts the phrase coffee & cake, but putting that phrase directly into a query string can change how the URL is read. The ampersand usually separates query parameters. If it belongs to the search phrase, it needs to be represented as data so the receiver knows it is part of the value. Percent encoding gives that character a spelling that can travel inside the URL.
TinyToolbox URL Encoder and Decoder converts a single component to its percent-encoded form or reads the percent escapes back as text. Use it for a query value, a parameter name, or one path segment. Decide which characters are intentional URL separators before applying the conversion.
Locate the component you want to encode
Consider a link to a search page with a search term and a page number:
https://example.com/search?q=coffee%20%26%20cake&page=2
The question mark starts the query. The ampersand before page separates the parameters. The equals signs attach each name to its value. Those characters are part of the URL structure and should remain in place when you assemble the link.
The text coffee & cake is the value of q. The spaces become %20, and the ampersand inside that value becomes %26. Encode the value on its own, then add it after q=. If you paste the entire address into the encoder, it will also encode characters such as the colon, path slashes, and question mark. That output is useful only when the entire address must travel as data inside another value.
A path works in a similar way. If you need to add Spring workshop as the next segment after /events/, encode that name and append Spring%20workshop. Keep the slashes that separate the path segments. A slash that is itself part of a segment can be encoded as %2F, but some servers and routing systems apply their own rules for encoded slashes. Test such a value against the receiving application when its behavior matters.
Use Encode and Decode in TinyToolbox
- Open URL Encoder and Decoder.
- Paste the component into Input text.
- Choose Encode or Decode under Operation.
- Select Run tool and review Result.
- Select Copy result once the output matches what the destination expects.
The tool runs in your browser. Encode uses JavaScript’s component encoding behavior. Decode reads percent escapes in a component and interprets them as UTF-8. The decoder leaves literal plus signs alone. If you are working with form-encoded query values, determine how the source treats plus signs before interpreting the result.
For a quick round trip, encode coffee & cake, copy the result, and use it as the input to Decode. The text should return with both spaces and the ampersand. This exercise checks the component by itself. The assembled link still needs to be tested where it will be used.
Recognize common escapes and their meanings
| Input text | Encoded component |
|---|---|
coffee & cake |
coffee%20%26%20cake |
C++ |
C%2B%2B |
café |
caf%C3%A9 |
10% |
10%25 |
a/b |
a%2Fb |
#notes |
%23notes |
Each percent escape is a percent sign followed by two hexadecimal digits. Some characters require multiple escapes because they use several bytes in UTF-8. The final letter in café becomes %C3%A9. The rule works on the bytes of the original character rather than its visual width on screen.
The component encoder leaves some characters as they are, including ASCII letters, digits, hyphens, underscores, dots, and tildes. It also leaves several punctuation marks that some protocols may require you to encode. If a signing or canonicalization specification gives an exact encoding rule, use the implementation for that protocol and test against its fixtures. A component that works in an ordinary link can still differ from the exact bytes a particular receiver expects.
Tell a plus sign from a space
The encoder represents a space as %20. A literal plus sign becomes %2B. Some forms and query-building libraries use a plus sign to represent a space instead. This convention can make an incoming value ambiguous until you know how it was produced.
Suppose the received query value is A+B. In a form-encoded query it can represent A B. In a context that treats plus signs literally, it could represent A+B. Paste A+B into the TinyToolbox decoder and the plus sign stays in the result, because there is no percent escape to convert. Paste A%2BB into the decoder and you also get A+B, this time from an explicit escape.
When debugging a form, compare the original field text with what the application receives after its normal parsing step. If a search term C++ becomes **C **, check whether the plus signs reached the query as literal plus signs instead of their encoded form. Build the query with your application’s normal query-parameter encoder when possible, supplying raw values so it can apply its own convention once.
Avoid encoding the same component twice
Imagine you already encoded Spring workshop as Spring%20workshop. If you paste the encoded value back into Encode, the percent sign becomes %25. The new output is Spring%2520workshop. Decoding it once yields Spring%20workshop, and decoding that intermediate result yields the original phrase.
Double encoding can happen when you manually prepare a component and pass it to a library that also encodes input. Find out whether the next step takes raw text or an already encoded component. When building a query with a library that handles escaping, pass Spring workshop as the parameter value. If you are assembling a link from a string you prepared yourself, insert the encoded component at the intended place and check the final address.
There are legitimate cases for two layers. For example, an already assembled URL can become the value of a query parameter in a separate URL. In that case, the outer query encoder must treat the entire inner address as data, including any percent signs it contains. Test one layer at a time and verify what each receiver should see after its own decoding.
Decode one value without flattening the whole URL
If you have a full URL, use URL Parser to inspect its structure or isolate the specific encoded value you want. Decode that value separately. Decoding the whole address at once can make an escaped ampersand look like a parameter separator, even though it originally belonged in a value. An escaped question mark or slash can cause similar confusion if you read the decoded string as another URL.
If the decoder reports an error, check for a percent sign without two following hexadecimal digits. A bare percent sign in 10% is ordinary text and should be encoded if it is meant to travel inside a component. A partial escape such as %A can come from a cut-off copy. Also check whether the escaped bytes represent valid UTF-8. An older source that uses another text encoding may need its own decoder.
When the decoded result contains another percent escape, resist the urge to keep decoding until every percent sign is gone. The remaining escape might be meaningful text, part of a nested URL, or evidence of accidental double encoding. Compare it with the expected input and follow the rules of the receiver rather than guessing from the appearance.
Verify the assembled link in its intended context
Check the components individually, then assemble the link and run the application’s normal parsing or navigation step. Confirm that the search phrase arrived as one value, that the page parameter still exists, and that a path segment was interpreted as intended. For a shared example, replace private query values with fictional data. Encoding a value does not prevent another person from reading it in a link or in a log.
Keep a small example containing the character that caused the problem. A test with a space, an ampersand, a plus sign, or an accented letter is easier to repeat than a long production URL. The conversion is ready when the final receiver reads the intended value and the URL separators still describe the structure you meant to send.
Put a URL inside a query value without losing its parameters
Imagine a documentation page accepts a parameter named example that contains another URL as text. You want that value to be https://example.com/search?q=tea&sort=new. The outer URL also has its own parameter named view. If you insert the inner URL as raw text, its ampersand can be read as a separator in the outer query. The outer address might then contain a parameter named sort even though you intended sort=new to stay inside the example value.
Paste the complete inner URL into URL Encoder and Decoder as a single component and run Encode. The result is https%3A%2F%2Fexample.com%2Fsearch%3Fq%3Dtea%26sort%3Dnew. Put that encoded value after example=, then append the outer separator and view=compact. Here the inner ampersand appears as %26, while the outer ampersand remains a literal separator. The question mark that introduces the outer query remains literal as well.
To verify the result, parse the outer URL using the destination’s normal query handling. Its two keys should be example and view. The decoded value for example should contain the complete inner address, including the ampersand and sort=new. The value for view should remain compact. If the resulting query contains a third key named sort, check whether the inner value was sent without encoding.
A typical query-building API can do the component encoding for you. When using that API, supply the original inner address as the raw value. Verify the parsed result, since the encoded spelling can vary with the library’s convention. When you assemble a URL by hand, use the encoder’s result in the intended value slot. Passing an already encoded value into an API that expects raw text can cause its percent signs to be encoded again.
Check decoding separately at each layer
Suppose the inner URL already contains a query value of green%20tea. The inner percent sign is part of the literal URL text that the outer query must carry. Encoding that entire text for the outer parameter will encode the percent sign as %25. When the receiver parses the outer query, it should recover the inner URL containing green%20tea. A later parser of the inner query interprets that escape to recover the phrase green tea.
This is two layers with different parsing jobs. If the outer parser produces green tea inside the URL text where you expected green%20tea, look for an extra decoding step. If the inner parser produces the literal text green%20tea where you expected the phrase, check which layer encoded or decoded the value. Write down the expected representation at each boundary so you can see where the first mismatch occurs.
When debugging, copy the raw URL as well as the application’s parsed values. A browser address bar or developer panel can present a visually simplified form, so a screenshot alone may hide the escaping difference. Build a small test containing the troublesome character and compare the keys and decoded values one by one. This keeps the focus on which characters belong to the data and which define the outer structure.