What is URL encoding?
URL encoding, also called percent-encoding, replaces characters a URL cannot safely carry with a % sign followed by two hex digits — the byte value of the character. A space becomes %20, an ampersand becomes %26, and the French é becomes %C3%A9 (its two UTF-8 bytes). It exists because URLs were designed for a tiny ASCII alphabet: anything outside it — spaces, accents, emoji, symbols with structural meaning — must be encoded so every server on the internet reads the URL the same way.
This tool does both directions live as you type, with four clearly labelled modes, a per-character breakdown that shows exactly why each byte was encoded, an integrated query-string parser, double-encoding detection, and honest, pinpointed errors when your input is malformed. Paste URLs with API keys or tokens without fear — nothing leaves your browser.
How to encode a URL (3 steps)
- Paste the text or URL. A search phrase, a value for a query parameter, or a whole address. The result appears as you type — there is no button to press.
- Pick the mode. Component for one value going into a URL, Full URL for a complete address, Form for data from an HTML form, Strict RFC 3986 for maximum safety. The wrong mode is the most common cause of broken links — see the table below.
- Copy the result. One click copies it, or download it as a .txt file. To go the other way, switch to Decode and paste the encoded string back.
Which mode should I use?
| Mode | Use when | Leaves unescaped |
|---|---|---|
Component encodeURIComponent | One value inserted into a URL — query value, path segment, slug (default) | A–Z a–z 0–9 - _ . ! ~ * ' ( ) |
Full URL encodeURI | A complete, already-structured URL | Component set + ; / ? : @ & = + $ , # |
Form application/x-www-form-urlencoded | HTML form or query-string data — space becomes + | A–Z a–z 0–9 * - . _ |
| Strict RFC 3986 | Maximum safety — specs, signatures, OAuth flows | A–Z a–z 0–9 - . _ ~ |
The same URL looks different in each mode. For https://example.com/street/About us?q=Cheese#contact: Component encodes everything, including the slashes and the colon; Full URL keeps the structure and only encodes the space; Strict RFC 3986 encodes the same as Component plus ! ' ( ) *; Form turns the space into a +. Rule of thumb: whole URL → Full URL; each value you insert → Component.
The + pitfall: why plus means space in queries but not paths
This single character is the #1 source of URL encoding bugs. In a query string parsed as form data, + means space — so a literal plus must be sent as %2B, or C++ in a form query decodes as "C ". But in a path, + is a literal plus: /files/hello+world.txt is a file whose name contains plus signs. To make it worse, JavaScript's decodeURIComponent never converts + at all — you must replace it before decoding. This tool has a "Decode + as space" checkbox that does the replacement correctly, in the right order (a real %2B still survives as +), and the query parser has it on automatically because that is the only context where it applies.
What is double encoding? (%2520)
Double encoding is encoding an already-encoded string again. Since % itself encodes as %25, the sequence %20 becomes %2520. Decoding once gives %20 — still encoded, not a space. It happens when a framework auto-encodes a value you already encoded, or when redirects encode the same parameter on every hop. This tool warns you whenever it sees %25 followed by two hex digits, shows the encoding depth, and offers one-click unwrapping — never an automatic fix, because sometimes double-encoded text is genuinely what you have to work with.
Common percent-encodings reference
| Character | Meaning / note | Encoded |
|---|---|---|
| (space) | Space | %20 |
| ! | Exclamation mark | %21 |
| " | Double quote | %22 |
| # | Hash / fragment start | %23 |
| $ | Dollar | %24 |
| % | Percent (the escape sign itself) | %25 |
| & | Ampersand (separates parameters) | %26 |
| ' | Apostrophe | %27 |
| ( | Open parenthesis | %28 |
| ) | Close parenthesis | %29 |
| * | Asterisk | %2A |
| + | Plus (means space in form data) | %2B |
| , | Comma | %2C |
| / | Slash (path separator) | %2F |
| : | Colon | %3A |
| ; | Semicolon | %3B |
| < | Less than | %3C |
| = | Equals (key = value) | %3D |
| > | Greater than | %3E |
| ? | Question mark (starts the query) | %3F |
| @ | At sign | %40 |
| [ | Open bracket | %5B |
| \ | Backslash | %5C |
| ] | Close bracket | %5D |
| ^ | Caret | %5E |
| ` | Backtick | %60 |
| { | Open brace | %7B |
| | | Pipe | %7C |
| } | Close brace | %7D |
Careful with two of these: : is %3A — a popular encoder's reference table lists it as %3D, but that is the code for =. And é is two triplets, %C3%A9, because it is two UTF-8 bytes — every non-ASCII character encodes byte by byte, which is why the breakdown table above lists one row per character with all its bytes.
Encode a URL in code
Prefer to encode in your own program? The tool above generates the exact code for your input — here are the patterns:
JavaScript
// Encode a single value for use in a query string
encodeURIComponent("hello world & more"); // "hello%20world%20%26%20more"
// Encode a full URL, preserving structural characters (: / ? & = #)
encodeURI("https://example.com/search?q=hello world");
Python
from urllib.parse import quote, quote_plus
quote("hello world & more", safe="") # strict, close to RFC 3986
quote_plus("hello world") # form encoding: "hello+world"
PHP
rawurlencode("hello world"); // close to strict RFC 3986
urlencode("hello world"); // form encoding: "hello+world"
curl
curl -G "https://example.com/search" --data-urlencode "q=hello world" # note: --data-urlencode always uses form encoding (+ for spaces)
What this tool does NOT do
Here is the honest answer: encoding is not encryption, and it does not make a URL safe.
Percent-encoding only changes how characters are written — anyone can decode %20 back to a space. Never use it to hide a token, a password or personal data. It is also not a security escape: encoding a <script> tag does not make it safe to put in HTML, and it does not protect a database query.
It also cannot fix a broken URL. If the address has the wrong host, a missing slash or a typo, encoding will faithfully preserve the mistake — it only escapes characters, it never corrects structure. And it cannot tell you whether a URL is safe to open: a perfectly encoded link can still point to a phishing page. Check the domain before you click.
Finally, encoding is not the same as Base64. Base64 recodes every byte into a 64-character alphabet, making output about 33% larger and unreadable — and standard Base64 itself needs URL escaping. Use percent-encoding for URLs, and Base64 only when a system asks for it by name.
More free tools
More free tools from The Cited Brand:
- llms.txt Generator & Validator — make a clean llms.txt file for your site in 2 minutes, and check any file against the basic rules.
- AI Crawler Checker — see whether GPTBot, ClaudeBot, PerplexityBot and 20 more AI crawlers can reach your site, or your robots.txt blocks them.
- Schema Markup Generator — make valid JSON-LD code for your pages, so search engines understand what each page is about.
- robots.txt Checker — check any site's robots.txt file: rules by bot, problems in plain words, a per-bot verdict table, and a tester for single pages.
- robots.txt Generator — build a robots.txt file in minutes: pick which AI bots may visit, add your sitemap, and download the file.
- AI Crawler Diagnostic Tool — diagnose your site for AI crawlers: find what blocks them and get the exact fix for each problem.
- AI Crawler Monitoring — keep watch after the check: spot AI bot visits in your server logs, Cloudflare analytics, and GA4.
- AI Agent Directory — the full list of 23 AI crawlers: who runs each one, what it does, and how to check a real visit.
- Secure Password Generator — generate a secure password or a word-based passphrase in one click. Made in your browser, never stored or sent anywhere.
- QR Code Generator — make a free QR code that never expires, for a link, text, Wi-Fi, email or phone. No account, no tracking, nothing uploaded.
- Password Strength Checker — check a password you already have: entropy, crack time, and pattern warnings, all in your browser.
- API Key Generator — make random API keys, secrets, and JWT signing secrets for your apps. Made in your browser, never stored or sent anywhere.
- QR Code Reader — scan a QR code from an image or your camera and see what it holds, with a warning for risky links. Nothing uploaded.
- UUID Generator — make UUIDs in one click — v4, v7, v1, v6, or name-based v3/v5. Bulk up to 1,000. Made in your browser, never stored or sent anywhere.
- Lorem Ipsum Generator — generate lorem ipsum in one click — paragraphs, sentences, words, characters or lists, as plain text, HTML, Markdown or JSON. Made in your browser, never stored or sent anywhere.
- Timestamp Converter — convert a Linux timestamp to a date and back — seconds, milliseconds, microseconds or nanoseconds, in any timezone, with copyable date commands. Made in your browser, never stored or sent anywhere.
- DNS Leak Check — check for DNS leaks: WebRTC test, visible IP + ISP + ASN, IPv6 exposure, encrypted-DNS reachability, and a DNS resolver identifier. Honest about its limits, no VPN ad.
- Tip Calculator — calculate a tip, the total and each person's share — bill, tip %, split, round-up, service presets and a comparison table. Free, no sign-up, nothing stored.
- Invoice Generator — make a free invoice in minutes — business and client details, line items, tax, discount and payment terms, then print or save as PDF. Free, no sign-up, nothing stored.
- Case Converter — convert text to lower case, Title Case, UPPER CASE, Sentence case and 11 more — camelCase, snake_case, kebab-case and more. Free, in your browser, nothing stored.
- URL Encoder & Decoder — encode and decode URLs — component, full URL, form and strict RFC 3986 modes, per-character breakdown and a query-string builder. Free, in your browser, nothing stored.
Frequently asked questions
What is URL encoding?
URL encoding, also called percent-encoding, replaces characters a URL cannot safely carry with a % sign followed by two hex digits — the byte value of the character. A space becomes %20, an ampersand becomes %26, and the French é becomes %C3%A9 (its two UTF-8 bytes). It exists because URLs were designed for a tiny ASCII alphabet: anything outside it must be encoded so every server reads the URL the same way.
What does %20 mean in a URL?
%20 is a space. The % starts a percent-encoded byte, and 20 (hex) is 32 in decimal — the ASCII code for a space. So 'hello world' becomes 'hello%20world'. You will see the same pattern for other characters: %26 is &, %3F is ?, and %C3%A9 is é.
What is the difference between encodeURIComponent and encodeURI?
encodeURIComponent is for a single value going into a URL: it encodes everything except A–Z, a–z, 0–9 and - _ . ! ~ * ' ( ). encodeURI is for a whole, already well-formed URL: it additionally leaves ; / ? : @ & = + $ , # untouched so the URL's structure survives. The classic bug is calling encodeURI on a value that contains & — the & stays, so the query parses as two parameters. Rule of thumb: whole URL → encodeURI; each value you insert → encodeURIComponent.
When should I use form encoding, with + for spaces?
Use + only in form-encoded query data — the format HTML forms submit and most servers expect in ?key=value pairs. Use %20 everywhere else: paths, fragments, slugs, and any value handled as a single opaque string. Many servers read both, which is why the confusion survives — but in a path, + is a literal plus, so %20 is the safe universal choice.
What is double encoding, and how do I fix %2520?
Double encoding is encoding an already-encoded string again. Since % itself encodes as %25, the sequence %20 becomes %2520. Decoding once gives %20 — still encoded, not a space. It happens when a framework auto-encodes a value you already encoded, or when redirects encode the same parameter on every hop. Fix it by decoding once more: this tool warns you when it sees %25 followed by two hex digits and offers one-click 'decode one level'.
Which characters must always be encoded in a URL?
Always encode: spaces, %, " < > \ ^ ` { | }, control characters, and every non-ASCII character (encoded as its UTF-8 bytes). In query values, also encode &, = and + because form and query conventions give them structural meaning — a literal + in a form query decodes as a space. The strict RFC 3986 set also encodes ! ' ( ) *, which JavaScript's built-ins leave as-is.
How do I encode a URL in code?
In JavaScript: encodeURIComponent(str) for a value, encodeURI(str) for a whole URL. For strict RFC 3986 add .replace(/[!'()*]/g, c => '%' + c.charCodeAt(0).toString(16).toUpperCase()). In Python: urllib.parse.quote(text, safe='') is close to strict RFC 3986; quote_plus(text) produces form encoding (+ for spaces). In PHP: urlencode() is form encoding, rawurlencode() is close to strict. The tool above has a 'Do it in code' panel that generates these snippets for your exact input.
Is URL encoding the same as Base64?
No. Base64 recodes every byte into a 64-character alphabet, making output about 33% larger and unreadable, and standard Base64 itself needs URL escaping. Percent-encoding only escapes the characters a URL cannot carry and leaves everything else readable — 'caf%C3%A9' still clearly says café. They solve different problems.
Why does + mean a space in a query but not in a path?
In a query string parsed as form data, + means space — so a literal plus must be sent as %2B, or C++ in a form query decodes as 'C '. But in a path, + is a literal plus: /files/hello+world.txt is a file whose name contains plus signs. To make it worse, JavaScript's decodeURIComponent never converts + at all — you must replace it before decoding. This tool has a 'Decode + as space' checkbox that does the replacement correctly, in the right order, so a real %2B still survives as +.
Is my URL uploaded or stored?
No. Encoding and decoding happen entirely in your browser using built-in JavaScript functions — you can verify this in the Network tab, or disconnect from the internet and the tool still works. This matters because URLs routinely carry tokens, API keys and session IDs: some popular tools process your input on their servers by default. Nothing you paste here ever leaves your device.