Base64 Encoder and Decoder

Encode and decode UTF-8 text with standard or URL-safe Base64 output.

Mode

Encode

Input size

19 B

Output size

28 B

Base64 converter

Encode and decode UTF-8 text in the browser.

Output
SGVsbG8gZnJvbSBNb3dhdG9vbA==

Related calculators

What is the Base64 encoder and decoder?

This tool converts text, images, and files into Base64 and restores Base64 data back to the original form. Base64 represents binary data as safe ASCII text, which is why it appears in web development, API calls, email, certificates, JWT, and inline image workflows.

The converter supports text conversion, file encoding, image preview, Data URI generation, URL-safe mode, and local history. All processing happens in the browser, so input data is not uploaded to a server.

How Base64 encoding works

Encoding process and alphabet

  • Base64 reads input as 8-bit bytes, groups 3 bytes into 24 bits, then splits that into 4 groups of 6 bits.
  • Each 6-bit value maps to one printable ASCII character from A-Z, a-z, 0-9, plus + and /, with = used as padding.
  • Because 3 bytes become 4 Base64 characters, size increases by about 33.3%; padding can push the overhead up to about 37%.
  • The standard is defined in RFC 4648.

URL-safe Base64 and Unicode

  • URL-safe Base64 replaces + with -, replaces / with _, and often removes = padding because those characters can have special meaning in URLs and filenames.
  • Basic Auth commonly encodes username:password, such as admin:password123 to YWRtaW46cGFzc3dvcmQxMjM=.
  • Korean text in UTF-8 uses 3 bytes per Hangul syllable, so encoded output is longer than English. Hello is 5 bytes and becomes 8 characters; a 5-syllable Korean greeting is 15 bytes and becomes 20 characters.
  • Browser btoa() only handles Latin-1 directly, so this tool uses TextEncoder to encode Unicode text as UTF-8 bytes first.

Security and practical limits

Encoding is not encryption

  • Base64 changes the representation of data; it does not protect the data.
  • No key is needed to decode Base64, and anyone can restore the original content.
  • Passwords, API keys, personal information, and other sensitive data need real encryption such as AES or RSA, not Base64 alone.
  • PEM certificate bodies are Base64 between BEGIN and END tags, and decoding them reveals DER certificate bytes.

Developer guidance

  • Use Data URI only for small icons or logos, generally 10 KB or less; larger assets are usually better served as separate files for caching.
  • MIME email Base64 inserts CRLF line breaks every 76 characters, and the tool can generate this format.
  • The source UI limits file conversion to 5 MB because a 5 MB file becomes about 6.7 MB of Base64 text and browser memory can become unstable with very large files.
  • Recent 10 conversions are stored locally for reuse, with text/file and encode/decode type separated.