Skip to main content

Base64 Encoder & Decoder

Encode UTF-8 text as Base64 and decode Base64 to text

Output Format:

Text input and uploads are limited to 10 MiB. Binary image files are not encoded as raw bytes.

Was this Base64 Encoder & Decoder helpful?

Help us keep tools reliable, fast, and bug-free.

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

TWFueSBoYW5kcyBtYWtlIGxpZ2h0IHdvcmsu

Practical workflow

  1. Select Encode to turn text into Base64, or Decode to read a Base64 value as UTF-8 text.
  2. Enter text or a Base64 value in the input editor; Unicode text is encoded as UTF-8 bytes.
  3. Select Convert and inspect the output. Invalid Base64 shows an inline error that clears when you edit the input.
  4. 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 0

Encodes 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 -D

Standard 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.b64

Encodes large binary files reliably across both Linux and macOS workstations.

Base64 Variant & RFC Comparison

VariantRFC SpecificationChars 62 & 63Padding CharacterURL & Filename Safe
Standard Base64RFC 4648 §4+ and /= (1 or 2 chars)No (+ and / require URL escaping)
Base64URLRFC 4648 §5- and _None or = (optional)Yes (safe in query parameters and JWTs)
MIME Base64RFC 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