Rankato

Free URL Encoder & Decoder

Percent-encode text for safe use in URLs, or decode encoded strings back to readable text. Component, URI, and form-encoded variants with batch mode — all in your browser.

Plain text or URL
Percent-encoded
0 chars · 0 BComponent
Your percent-encoded output will appear here.
0 charsspace → %20

Encoded in your browser · nothing is uploaded

The URL Encoder/Decoder converts text to and from percent-encoding — the escape format URLs use to safely carry characters like spaces, non-ASCII letters, and reserved symbols. Paste a value to encode it, paste an encoded string to decode it, or paste many lines at once and toggle per-line batch to process each line independently. Three variants cover every real-world case: Component (encodeURIComponent) for single query values and path segments, URI (encodeURI) for whole URLs (preserves :/?#&=), and Form (application/x-www-form-urlencoded) where spaces become +. Decoding auto-handles + vs %20 and gives you a clear line-numbered error when the input has malformed escapes. Everything runs in your browser — nothing is uploaded.

What is URL / percent-encoding and when do you need it?

URLs are ASCII text with a strict grammar. Certain characters are reserved because they have structural meaning — / separates path segments, ? starts the query string, & separates query parameters, # starts a fragment. Other characters are unsafe because they can confuse parsers or intermediaries — spaces, control characters, non-ASCII bytes, quotation marks. Percent-encoding (RFC 3986) is the mechanism URLs use to escape any of those: each unsafe byte becomes % followed by two hex digits. So a space becomes %20, an at sign becomes %40, and the letter é (UTF-8 bytes 0xC3 0xA9) becomes %C3%A9. You'll encounter percent-encoding whenever you build a URL from user input — search queries, filenames, tokens, redirect URLs — and whenever you read one back from a browser address bar, a server log, or an incoming request.

Component vs. URI vs. Form — which variant should you pick?

Three variants cover almost everything. Component uses JavaScript's encodeURIComponent and encodes every character that isn't unreserved (A–Z a–z 0–9 - _ . ~). Use it when you're building a single query value, path segment, or fragment — anywhere the string should not be interpreted as URL structure. URI uses encodeURI and preserves reserved characters (: / ? # & = + , ;) because they still carry meaning inside a full URL. Use it when you have a complete, mostly-valid URL and just want to escape spaces or non-ASCII. Form encodes the same as component but replaces %20 with +, matching the application/x-www-form-urlencoded MIME type that HTML forms and many APIs use. If you're not sure, pick Component — it's the safest default for embedding untrusted values into a URL.

Why + and %20 both mean space (and when they don't)

Inside a query string (the part after ?), historical HTML form conventions treat + as a shorthand for space. Inside a path or fragment, + is a literal plus sign. That's why decoding a URL correctly requires knowing which part you're looking at. This tool's Form variant and the Encode spaces as + option both switch to the plus convention; the decoder handles + automatically in Form mode or when you enable the toggle. If you're decoding a query string parsed from a Content-Type: application/x-www-form-urlencoded request body — that includes almost every HTML form submission — treat + as space. If you're decoding a full URL character by character, be careful: a literal + in a path (like /c++/) is not a space.

UTF-8, non-ASCII characters, and the two-step process

Percent-encoding escapes bytes, not characters. So encoding text that contains anything outside plain ASCII is a two-step process: first the text is turned into bytes (using UTF-8 in modern URLs), then each non-safe byte is written as %HH. The character café is four Unicode codepoints, but nine UTF-8 bytes when encoded: c a f %C3 %A9. Older systems sometimes used Latin-1 or Windows-1252 instead of UTF-8, which is why you occasionally see mojibake — the encoder used one byte scheme and the decoder assumed another. This tool uses UTF-8 throughout (via the browser's built-in encodeURIComponent and decodeURIComponent), so any modern URL round-trips cleanly. If a decode step fails with a URIError, the input is almost always malformed: a lone %, a %X where X isn't hex, or a percent-escape that isn't a valid UTF-8 byte sequence.

Per-line batch mode — encoding lists of URLs or values

Turn on Encode each line separately when you have a list of values — one per line — and want each one processed independently. Without batch mode, the whole textarea is treated as a single string and newline characters themselves get encoded as %0A. With batch mode on, newlines are preserved as separators, and every line is encoded or decoded on its own. That's the shape you want when preparing a CSV column of query values, a list of UTM-tagged URLs, or a batch of filenames to appear in an href. In decode mode, if any line has malformed encoding the tool reports the line number so you can find and fix it quickly rather than losing the whole batch.

Tool FAQs

Everything you need to know about using URL Encoder / Decoder.

What's the difference between encodeURI and encodeURIComponent?+

encodeURI is for entire URLs and preserves the reserved characters that give a URL its structure — :, /, ?, #, &, =, +, ,, ;. encodeURIComponent is for individual pieces you plan to stitch into a URL — a single query value, a path segment, a fragment — and encodes every character that isn't in the small set of unreserved characters (A–Z a–z 0–9 - _ . ~). Rule of thumb: use component for values, URI for whole URLs. If you're not sure, use component — over-encoding an already-safe character is harmless; under-encoding a structural character breaks the URL.

Why is a space sometimes %20 and sometimes +?+

Two conventions coexist. RFC 3986 — the URL spec — says a space is always %20. application/x-www-form-urlencoded — the format HTML forms POST and the format query strings usually follow — allows spaces to be written as + as a shorthand. Both are valid; which one a decoder should use depends on the context. Servers that parse query strings and form bodies universally accept both. If you're generating a link that a browser will treat as a URL, either works. If you're generating an OAuth signature base string or anything where the exact bytes matter, use %20.

Why does my decode fail with URIError: malformed URI sequence?+

The input contains a % that isn't followed by two valid hex digits, or the escape sequence doesn't map to a valid UTF-8 code point. Common causes: someone typed a literal % without meaning percent-encoding, the string was double-encoded and truncated, or it was encoded as Latin-1 bytes that aren't valid UTF-8. Look for lone % characters, %X where X isn't hex, or high-byte sequences like %E9 (Latin-1 é) that would need to be %C3%A9 in UTF-8. This tool reports the failing line number in batch mode to help pinpoint the issue.

Is it safe to encode the same string twice?+

Safe, but usually a bug. Encoding hello world once gives hello%20world. Encoding that again gives hello%2520world — the % became %25. If a server ever decodes that twice, you're back to hello world; if it decodes once, you get hello%20world as a literal value. Double-encoding is a common source of broken links and mysterious search failures. If you're pulling a value from a source that might already be encoded (a query string parameter, a Referer header, a redirect URL), decode first, then re-encode with the variant you want.

What characters are safe and don't get encoded?+

encodeURIComponent leaves alone the unreserved set: uppercase and lowercase letters, digits, and four punctuation marks — - _ . ~. Every other character (including !, *, ', (, ), and all reserved characters like :/?#&=) is percent-encoded. encodeURI additionally leaves alone the reserved set so a full URL still parses. Some legacy systems use a stricter always-encode list — for example, RFC 3986 says !*'() are technically reserved (sub-delims) and encoding-required in some contexts. This tool follows the modern browser behaviour, which is what almost every real-world consumer expects.

Can I encode a whole URL including its query string?+

Yes — switch to the URI variant. That uses encodeURI, which preserves the URL's structural characters (:/?#&=+,;) and only escapes spaces, non-ASCII, and other unsafe bytes. So https://example.com/search?q=hello world&lang=en becomes https://example.com/search?q=hello%20world&lang=en — a valid URL that browsers and servers accept. Do not feed a full URL through Component mode: it will escape the :, /, and ? and produce something no server can parse as a URL.

Does this tool send my data to a server?+

No. All encoding and decoding runs entirely in your browser using the built-in encodeURIComponent, encodeURI, decodeURIComponent, and decodeURI APIs — the same functions your JavaScript uses. Open your browser's Network tab and confirm zero requests fire while you paste or type. That makes it safe to encode tokens, tracking parameters, redirect URLs, or anything else you'd rather not hand to a random online tool.