Small Tools

Encoding ยท Developer Guide

Base64 Encoding and Decoding Explained

Base64 is useful when a protocol expects text but your data is bytes. Start by identifying the byte encoding and Base64 variant, then decode with a tool that matches both.

What is Base64?

Base64 represents bytes using a limited text alphabet. Standard Base64 includes + and /, with = used for padding. Base64URL uses different characters; a JWT segment and a standard Base64 string are not interchangeable without accounting for that variant.

How the text tools work

Small Tools first encodes input text as UTF-8 bytes, then produces standard Base64. Decoding reverses the process and requires the decoded bytes to be valid UTF-8. This supports Unicode text, but it is not a binary file viewer.

Base64 text is usually larger than the source bytes, roughly four output characters for every three bytes before transport overhead. Use it because the protocol requires it, not as compression.

Example: verify a text round trip

Encode Hello, copy the exact result, and decode it. Repeat with a Unicode sample such as Hello ๐ŸŒ to confirm that a downstream system uses UTF-8 too. A round trip proves the representation survived; it does not prove authenticity.

Input โ†’ Encoded โ†’ Decoded
Hello
SGVsbG8=
Hello

Common mistakes

  • Treating Base64 as encryption: anyone who obtains the text can decode it.
  • Decoding an entire JWT including dots: use the JWT-specific tool for segments and Base64URL.
  • Expecting an image or archive to appear as readable text: valid Base64 can decode to non-UTF-8 bytes and this text decoder will reject it.
  • Editing padding or replacing + with spaces during form transport: preserve the value using the transport's required encoding.

Practical use cases and security

For a Basic Authentication header, use the dedicated builder so the username, separator, password, and byte encoding are handled together. Send credentials only over HTTPS; Base64 offers no secrecy.

For an integration mismatch, compare the original bytes, variant, padding expectations, and character encoding on both sides. The linked text tools process locally. Redact secrets before storing the output in documentation or support tickets.

Related tools

  • Base64 Encoder โ€” Encode text as Base64 with Unicode support.
  • Base64 Decoder โ€” Decode Base64 text safely in your browser.
  • JWT Decoder โ€” Decode a JWT header and payload without verifying its signature.
  • Basic Auth Header Generator โ€” Create an HTTP Basic Authorization header locally from a username and password.

References

Browse all developer guides โ†’