Scrawlspace › Developer Utilities
Base64 Encode & Decode
Encode text as Base64, Base64URL, percent-encoded URL, HTML entities, Unicode escapes or hex, or paste encoded text to decode it. Text is encoded as UTF-8 first, so emoji and non-English text work. Everything runs in your browser, with no size limits or sign-up. Base64 is an encoding, not encryption: anyone can decode it.
How to use Encode / Decode
- Pick the Encoding: Base64, URL, HTML entities, Unicode escape or Hex.
- Choose Encode or Decode as the Direction, and tick any options, such as URL-safe (no padding) for Base64URL.
- Type or paste your text, or click Sample. The output updates as you type, with the character and byte count of each side.
- Click Use as input to move the output to the input and flip the direction, or Copy it.
Frequently asked questions
How do I decode a Base64 string?
Choose Base64, set the direction to Decode and paste the string. The decoded text appears immediately, including non-English characters and emoji. If the bytes aren't UTF-8 text, they're shown as hex instead.
Is Base64 encryption?
No. Base64 is an encoding: anyone can turn it back into the original without a key. Never use it to hide passwords or secrets. To check that data hasn't changed, use a hash; to keep it private, use real encryption.
What is the difference between Base64 and Base64URL?
Base64URL (RFC 4648 section 5) replaces + and / with - and _ and usually drops the = padding, so the result is safe in URLs and file names. Tick URL-safe (no padding) to encode with it. The decoder accepts both forms, with or without padding. JWTs use Base64URL; to read one, use the JWT decoder.
Why is my Base64 longer than the original?
Every 3 bytes become 4 characters, so Base64 output is about 33% larger than the input, plus up to two = signs of padding to make the length a multiple of 4.
Why does my Base64 fail to decode?
Usually one of these: it has a data:image/png;base64, prefix (remove it, or decode the image with Base64 to Image); it was cut short, so the length is wrong; or it contains characters outside A–Z, a–z, 0–9, +, /, - and _. Whitespace, line breaks and missing padding are ignored.
How do I URL encode a string?
Choose URL and Encode. Spaces and special characters become percent codes such as %20. Tick Whole URL to keep :/?&= so a full address stays usable, or Spaces as + for form-style query strings.
How do I convert an image to Base64?
This page encodes text. For images, use Image to Base64, which gives a data URI you can paste into HTML or CSS.
Is my text sent to a server?
No. Encoding and decoding run in your browser.
How Base64 works
Base64 (RFC 4648) writes binary data using 64 safe characters: A–Z, a–z, 0–9, + and /. Each group of 3 bytes (24 bits) is split into four 6-bit values, and each value becomes one character. That is why the output is about 4/3 the size of the input, roughly 33% bigger. When the input isn't a multiple of 3 bytes, = signs pad the end.
For example, "Hello, Scrawlspace! 👋" encodes to SGVsbG8sIFNjcmF3bHNwYWNlISDwn5GL. The browser's own btoa() throws an error on emoji because it only takes Latin-1; this tool encodes the text as UTF-8 first, so it doesn't.
What each encoding is for
| Encoding | Use it for | Example |
|---|---|---|
| Base64 | Binary data in text: email attachments, data URIs, HTTP Basic auth headers | hi → aGk= |
| Base64URL | Tokens and IDs in URLs and file names, JWT parts | No + / or = characters |
| URL (percent) encoding | Query string values and path segments (RFC 3986) | café & crème → caf%C3%A9%20%26%20cr%C3%A8me |
| HTML entities | Showing text safely inside HTML | <b> → <b> |
| Unicode escapes | Non-ASCII text in JSON, JavaScript or Java source | é → \u00e9 |
| Hex | Inspecting the raw bytes of text | Hi → 48 69 |
Encode a value vs a whole URL
By default URL mode works like JavaScript's encodeURIComponent: it escapes every reserved character, including / ? & =, which is right for a single query value. Whole URL works like encodeURI and keeps those characters, which is right for a complete address that only needs its spaces and non-ASCII characters escaped.