Base64 Encoder & Decoder
Base64 is a binary-to-text encoding scheme that represents any byte sequence using 64 printable ASCII characters, defined by RFC 4648. This tool encodes text to Base64 or decodes Base64 back to readable text, instantly and in your browser. UTF-8 safe (emoji and non-Latin text work), with an optional URL-safe alphabet for tokens and query strings. Nothing is uploaded, no sign-up.
0 characters
Common uses
Data URIs
Embed a small image or font directly in CSS/HTML as data:...;base64,... to save a request.
JWT & tokens
JSON Web Tokens are URL-safe Base64. Decode the header/payload segments to inspect claims (they are not encrypted).
API payloads
Move binary data through JSON or XML fields that only accept text, without corruption.
Basic Auth headers
The Authorization: Basic header is base64("user:pass"). Decode one to see the credentials it carries.
Email attachments
MIME encodes attachments as Base64 so binary files survive text-only mail transport.
Config & secrets files
Kubernetes Secrets and many config formats store values as Base64. Decode to read, encode to set.
Standard vs URL-safe Base64
Both encode the same data; they differ only in three output characters. Decoding here accepts either, and restores missing padding automatically.
Standard
Uses
+and/, pads the end with=. The default for email, data URIs, and most APIs.URL-safe
Replaces
+with-,/with_, and drops=padding, so it is safe in URLs, filenames, and JWTs.
How Base64 encoding works, a worked example
Base64 works in groups of 3 input bytes (24 bits), split into four 6-bit chunks. Each 6-bit chunk (a value from 0 to 63) maps to one of 64 characters. Encoding the text Hi! shows the mechanics:
H,i, and!are ASCII bytes 72, 105, 33, or in binary01001000 01101001 00100001. Regrouped into four 6-bit chunks that becomes010010 000110 100100 100001, which as decimal is 18, 6, 36, 33. Looked up in the Base64 alphabet (A-Z = 0-25, a-z = 26-51, 0-9 = 52-61, + = 62, / = 63), that givesS G k h, soHi!encodes toSGkh.Why the = padding: Base64 needs input in multiples of 3 bytes to fill four clean 6-bit chunks. When the input is not a multiple of 3, the last group is padded with zero bits and the output gets one
=(2 bytes left over) or two==(1 byte left over) so the decoder knows exactly how many trailing bits to discard. A length that is a multiple of 3 needs no padding at all.
Frequently Asked Questions
What is Base64 and what is it used for?▾
How do I encode text to Base64?▾
How do I decode a Base64 string?▾
What is URL-safe Base64?▾
Is my data sent to a server?▾
Why does my Base64 look longer than the original text?▾
Is Base64 encryption? Is it secure?▾
Why does decoding fail with "invalid character" or "invalid length"?▾
Can I decode Base64 back into an image or file, not just text?▾
By Toolember · Updated September 2026