What you can do with Base64 Encoder & Decoder
- Decode base64 string
- Encode text as base64
How this encoding and decoding works
Encode UTF-8 text as a standard RFC 4648 Base64 string, or decode Base64 bytes back to UTF-8 text.
Example input
Many hands make light work.Example output
TWFueSBoYW5kcyBtYWtlIGxpZ2h0IHdvcmsuPractical workflow
- Select Encode to turn text into Base64, or Decode to read a Base64 value as UTF-8 text.
- Enter text or a Base64 value in the input editor; Unicode text is encoded as UTF-8 bytes.
- Select Convert and inspect the output. Invalid Base64 shows an inline error that clears when you edit the input.
- Copy the result, or select Swap to use the result as the next input. Clear removes both editors' contents.
Common use cases
- Encoding short UTF-8 text values for APIs or configuration fields that explicitly expect Base64 text.
- Inspecting readable text that arrives Base64-encoded in API responses, logs, or configuration files.
- Preparing a UTF-8 text payload before another system wraps it in a text data URI.
Important notes and limitations
- Encoding uses UTF-8 bytes, so accented text, non-Latin scripts, and emoji round-trip correctly.
- Text inputs and uploads are limited to 10 MiB. Text uploads are read as UTF-8; SVG source can be uploaded in Encode mode. Binary image files are not encoded as raw bytes. Decoded bytes are interpreted as UTF-8, so arbitrary binary data may display replacement characters and is not exported byte-for-byte.
- CSS background and HTML img output require SVG source; those options stay disabled for plain text. This tool emits standard Base64 with padding and has no URL-safe or padding controls; standard Base64 also expands data by about 33%.
Terminal & CLI equivalents
GNU base64 encode (Linux)
echo -n "secret_data" | base64 -w 0Encodes data without column wrapping (-w 0 disables line breaks for single-line tokens).
macOS base64 encode / decode
echo -n "secret_data" | base64 && echo "c2VjcmV0X2RhdGE=" | base64 -DStandard macOS BSD base64 CLI; note the uppercase -D flag for decoding on macOS.
OpenSSL cross-platform base64
openssl base64 -e -in binary.dat -out encoded.b64Encodes large binary files reliably across both Linux and macOS workstations.
Base64 Variant & RFC Comparison
| Variant | RFC Specification | Chars 62 & 63 | Padding Character | URL & Filename Safe |
|---|---|---|---|---|
| Standard Base64 | RFC 4648 §4 | + and / | = (1 or 2 chars) | No (+ and / require URL escaping) |
| Base64URL | RFC 4648 §5 | - and _ | None or = (optional) | Yes (safe in query parameters and JWTs) |
| MIME Base64 | RFC 2045 | + and / | = (mandatory) | No (inserts CRLF every 76 columns) |
Common errors & troubleshooting
InvalidCharacterError: Failed to execute 'atob' on 'Window'
Cause: String contains multi-byte UTF-8 code points outside the Latin-1 (0-255) character range.
Solution: Encode strings with TextEncoder before converting bytes, or decode using TextDecoder on Uint8Array.
Illegal base64 data at input byte / Invalid length
Cause: Base64 string length is not divisible by 4, or whitespace/newlines are corrupting the payload.
Solution: Append '=' padding until the length is a multiple of 4, and strip all spaces and line breaks.
Continue your workflow
- JWT Debugger — inspect and verify Base64URL-encoded JSON Web Tokens with local cryptographic validation.
- Hash Generator — compute SHA-256 and SHA-512 hashes before encoding payloads into Base64 format.
- String Escaper — escape Base64 strings for direct inclusion in JSON, SQL, or programming language source.
- URL Encoder & Decoder — safely encode standard Base64 characters for query string and URI transmission.
Frequently asked questions
Does this tool generate URL-safe Base64?
No. It generates standard Base64 with +, /, and padding when needed. A URL-safe Base64 implementation replaces + with - and / with _ and may omit padding; this page has no URL-safe option.
Does this tool support non-ASCII characters such as emojis and accents?
Yes. The tool encodes text as UTF-8 bytes before converting those bytes to Base64, so emoji, accented text, and non-Latin scripts round-trip as text. Decoding arbitrary binary bytes as UTF-8 may produce replacement characters.
Why does Base64 encoding increase payload size by roughly 33 percent?
Base64 encodes each group of 3 bytes into 4 printable characters, with padding for a final partial group. The encoded text is therefore about 4/3 the byte length, before any surrounding data-URI or transport syntax.
Focused guides for this tool
- Base64 Encoder — Encode plain UTF-8 text into Base64.
- Base64 Decoder — Decode Base64 values into readable text.
- Base64 to SVG Converter — Decode Base64 strings and Data URIs into clean SVG vector markup with interactive visual rendering.