What is URL Encoding?
URL encoding (also known as percent-encoding) is a mechanism for converting characters that are not allowed in a URL into a safe, transmittable format. In a URL, only certain ASCII characters are permitted directly — letters (A–Z, a–z), digits (0–9), and a few special characters (-, _, ., ~). All other characters must be encoded.
When a character is encoded, it is replaced by a percent sign (%) followed by two hexadecimal digits representing its byte value in UTF-8. For example, a space becomes %20, and an ampersand (&) becomes %26.
Why is URL Encoding Important?
Without URL encoding, special characters in a URL can be misinterpreted by browsers and servers:
- A space in a query parameter breaks the URL structure
- An ampersand (
&) separates query parameters, so it must be encoded when used as a value - An equals sign (
=) separates keys from values in query strings - A hash (
#) signals a page fragment, not a value
URL encoding ensures data is transmitted safely and accurately across the web, REST APIs, and HTML forms.
Common Characters That Must Be Encoded
| Character | Encoded | Description |
|---|---|---|
| Space | %20 | Whitespace |
& | %26 | Ampersand |
= | %3D | Equals sign |
+ | %2B | Plus sign |
# | %23 | Hash |
? | %3F | Question mark |
/ | %2F | Forward slash |
: | %3A | Colon |
@ | %40 | At sign |
% | %25 | Percent sign itself |
< | %3C | Less than |
> | %3E | Greater than |
" | %22 | Double quote |
How to Use This Tool
- Paste or type the text you want to encode into the input box
- Click Encode URL — or enable Auto mode for instant encoding as you type
- Copy the encoded result from the output box
- Optionally upload a
.txtfile to encode its contents in bulk
To pre-fill the input via a URL, append ?input=your text to the tool address.
URL Encoding vs encodeURI vs encodeURIComponent
JavaScript provides two built-in encoding functions with different behaviors:
encodeURI()— Encodes a full URL. Does not encode characters that carry special meaning in URLs (/,?,=,&,#,:). Use this when encoding an entire address.encodeURIComponent()— Encodes a URL component (e.g., a single query parameter value). Does encode characters like&,=,?, and/. Use this for individual values inside a query string.
This tool uses encodeURIComponent(), making it ideal for encoding query string values, form data, and API parameters — the most common use case for developers.
Common Use Cases for Developers
- Building API request URLs — Encode parameter values before appending them to a request URL
- Encoding form data — Safely encode user-submitted text before sending it as a query string
- Generating share links — Encode text that will be passed as a URL parameter
- Fixing broken URLs — Clean up URLs that contain unencoded special characters
- Working with webhooks — Encode payload values in URL-based webhook integrations
Data as Parameter
You can pre-fill this tool’s input using a query string:
https://www.uprek.com/en/tools/url-encoder?input=hello world & more=1
This makes it easy to link directly to a pre-populated encoder — useful for documentation, tooling workflows, and sharing.
Technical Details
This tool runs entirely in your browser using the native JavaScript encodeURIComponent() function. No data is sent to any server. Processing is instant and works offline once the page has loaded.
encodeURIComponent() encodes all characters except: A–Z a–z 0–9 - _ . ! ~ * ' ( )
Security Considerations
- Double-encoding: Avoid encoding an already-encoded string.
%20encoded again becomes%2520, which is not what you want. Always start from the original, unencoded text. - Client-side only: No input data leaves your browser — this tool is fully private and requires no server connection.