Home › Base64 and URL Encoder / Decoder
Base64 and URL Encoder / Decoder
Convert text to Base64 or back, or make a string safe to place inside a URL, with correct handling of accents, symbols and emoji.
Results
- Characters in
- 23
- Characters out
- 36
- Output size (UTF-8 bytes)
- 36
How it works
Text is first turned into UTF-8 bytes, which is why accented letters survive a round trip. Base64 then writes every three bytes as four characters from a 64-character alphabet; the URL-safe variant swaps + and / for - and _ and drops the = padding. URL encoding writes each unsafe byte as a percent sign followed by two hexadecimal digits.
Rules and details
Base64: 3 bytes (24 bits) become 4 characters of 6 bits each; length = 4 × ceil(n ÷ 3)Base64URL: replace + with -, / with _, remove =URL component: every byte outside A-Z a-z 0-9 - _ . ! ~ * ' ( ) becomes %HHWhole address: also keeps ; , / ? : @ & = + $ # as they are
Worked example
The text “Héllo, wörld! 100% café” becomes SMOpbGxvLCB3w7ZybGQhIDEwMCUgY2Fmw6k= in Base64 and SMOpbGxvLCB3w7ZybGQhIDEwMCUgY2Fmw6k in Base64URL. As a URL component it becomes H%C3%A9llo%2C%20w%C3%B6rld!%20100%25%20caf%C3%A9. Decoding the Base64 form gives back “Héllo, wörld! 100% café”, so nothing is lost.
Frequently asked questions
Is Base64 a form of encryption?
No. Base64 only changes how bytes are written, and anyone can decode it. Never use it to hide a password or a token.
What is the difference between encoding a component and a whole address?
A component, such as a query value, must escape characters like & = / ? so they are not read as structure. A whole address keeps those characters because they separate its parts.
Why does decoding fail?
Base64 text may only contain letters, digits, + / (or - _) and optional = at the end, and its length cannot leave a single stray character. For URLs, a percent sign must be followed by two hexadecimal digits.
Tips
- Use Base64URL for JSON Web Token parts and for values placed in URLs.
- In query strings a + often means a space: choose “URL decode (+ as space)” for form data.
- Spaces and line breaks inside Base64 text are ignored when decoding.