Upload a file
  1. base64hub
  2. Web & token tools
  3. URL encode

URL Encoder (Percent-Encoding)

Paste text or a URL and get it percent-encoded. Pick Component for a query value or path segment, Full URL to fix a whole address, or Form data for application/x-www-form-urlencoded bodies.

Free no sign-up, no limits Local nothing uploaded 4 modes component, full URL, form data, every character Updated Oct 27, 2026
Input 0Output 0

Processed in your browser. This page cannot send your data anywhere – how we know

How to URL-encode a string

  1. Type or paste the text into Text or URL. The output updates as you type.
  2. Choose the mode under Encode:
    • Component (encodeURIComponent) for one query value, form field or path segment.
    • Full URL (encodeURI) for a complete URL that has spaces or non-ASCII characters in it.
    • Form data (space as +) for application/x-www-form-urlencoded bodies and query strings built the way HTML forms do it.
    • Every character to percent-encode all bytes, letters included, for testing decoders.
  3. Leave Charset on UTF-8 unless the receiving system expects a legacy encoding.
  4. Tick Each line separately to encode a list of values in one go, then Copy output. Swap sends the result to the decoder to check the round trip.

A full URL in the input is also split into scheme, host, path, each query parameter and the fragment, in a table under the panes.

encodeURIComponent vs encodeURI vs form encoding

The same input, a b&c=d/é?#+, in the three common styles:

ModeOutputUse for
Component (encodeURIComponent)a%20b%26c%3Dd%2F%C3%A9%3F%23%2Ba single value inside a URL
Full URL (encodeURI)a%20b&c=d/%C3%A9?#+a whole URL that is already structured correctly
Form data (URLSearchParams)a+b%26c%3Dd%2F%C3%A9%3F%23%2BHTML form posts, many query string libraries

Component leaves only A–Z a–z 0–9 - _ . ! ~ * ' ( ) unescaped. Full URL also keeps ; / ? : @ & = + $ , #, the characters that give a URL its structure, so it cannot protect a value that contains them. Form data keeps only letters, digits and - _ . *, and writes spaces as +.

The classic bug is building a URL with Full URL encoding: ?q=C++ & Go keeps the + and &, and the server receives q=C plus a stray parameter. Encode the value with Component instead: ?q=C%2B%2B%20%26%20Go.

Spaces, plus signs and other troublemakers

CharacterEncodedWhy it matters
space%20 or ++ only means space in query strings and form bodies
+%2Bunencoded, many servers turn it into a space: +49 30 1234567 becomes 49 30 1234567
&%26starts a new query parameter
=%3Dseparates name and value; standard Base64 ends with it
/%2Fsplits path segments; some servers reject %2F in paths
#%23starts the fragment, which is never sent to the server
%%25must be encoded itself, or the decoder reads a broken escape
€%E2%82%ACthree UTF-8 bytes, three escapes

Base64 in a URL is a common case of the +, / and = problem. Either percent-encode it as a component or switch to Base64URL, which avoids those characters.

Non-UTF-8 charsets

Percent-encoding works on bytes, so the charset decides the result. é is %C3%A9 in UTF-8 and %E9 in Windows-1252 or ISO-8859-1. Modern browsers and APIs use UTF-8, but older PHP applications, some payment gateways and legacy intranet systems still expect Latin-1 or Windows-1252, and Japanese sites sometimes Shift_JIS. Choose the charset under Charset to match. A character that does not exist in the chosen charset cannot be represented, so check the output for those.

URL encoding in code

encodeURIComponent("a b&c")              // "a%20b%26c"
new URLSearchParams({ q: "C++ & Go" }).toString()   // "q=C%2B%2B+%26+Go"
from urllib.parse import quote, quote_plus, urlencode
quote("/files/a b.txt")            # '/files/a%20b.txt'  (keeps / by default)
quote("/files/a b.txt", safe="")   # '%2Ffiles%2Fa%20b.txt'
quote_plus("a b&c")                # 'a+b%26c'
urlencode({"q": "C++ & Go"})       # 'q=C%2B%2B+%26+Go'

Python’s quote keeps / unless you pass safe="", a frequent surprise when encoding a value. Elsewhere: PHP’s rawurlencode gives %20 and urlencode gives +; Java’s URLEncoder.encode is form encoding with +; Go has url.PathEscape (%20) and url.QueryEscape (+). encodeURIComponent leaves ! ' ( ) * alone; for strict RFC 3986 output, replace them afterwards:

const strict = s => encodeURIComponent(s).replace(/[!'()*]/g,
  c => "%" + c.charCodeAt(0).toString(16).toUpperCase());

More on the JavaScript side is on the JavaScript Base64 page. To reverse any of this, use the URL decoder.

FAQ

What is URL encoding?

URL encoding, or percent-encoding, replaces characters that are not allowed or have a special meaning in a URL with % and two hex digits of each byte. A space becomes %20, & becomes %26, and é in UTF-8 becomes %C3%A9.

How do I encode a space in a URL: %20 or +?

%20 works everywhere. + means a space only in query strings and form bodies that follow the form-encoding convention; in a path it is a literal plus. When unsure, use %20.

Should I URL-encode the whole URL?

No, encode each value before you insert it. Encoding a whole URL with Component also escapes :, /, ? and &, which breaks it. Full URL mode keeps those structural characters and only fixes spaces and non-ASCII text.

Why does my encoded string contain %25?

%25 is an encoded percent sign, which means the input was already encoded and got encoded a second time: a%20b turns into a%2520b. Encode raw text exactly once.

Uppercase or lowercase hex in percent-encoding?

RFC 3986 treats %2F and %2f as the same and recommends uppercase. Tick Lowercase hex only when matching a system that produces lowercase, for example when comparing signatures.