Base64
Encode and decode Base64 strings
What Is Base64?
Base64 encodes arbitrary binary data as a string of 64 printable ASCII characters (A-Z, a-z, 0-9, +, /). The = padding at the end aligns the output to a multiple of 4 characters. The name comes from the 64-character alphabet, not from the number 64 itself.
Common Use Cases
- HTTP Basic Auth headers — Credentials are sent as
Authorization: Basic dXNlcjpwYXNz, which isuser:passbase64-encoded. This is encoding, not encryption — never rely on it for security without HTTPS. - Data URIs — Embedding small images in CSS:
url("data:image/png;base64,iVBORw0KGgo..."). Useful for small icons that save an HTTP request. - JSON Web Tokens — JWT header and payload segments are base64url-encoded (uses
-and_instead of+and/, no padding). - Email attachments — MIME encodes attachments in Base64 so binary data survives email transport, which was historically 7-bit ASCII only.
Base64 vs. Base64url
Standard Base64 uses + and /, which need percent-encoding in URLs. Base64url replaces them with - and _ and omits the = padding, making it safe in URL query strings and JWT segments without further encoding. This tool uses standard Base64.
Size overhead
Base64 increases size by approximately 33%. A 300-byte image becomes a 400-character string. For anything larger than ~1 KB, loading it as a separate resource is usually more efficient than inlining as a data URI.