Base64 Encoder/Decoder
Text & Data ToolsBase64 Encoder / Decoder
How to Use This Calculator
How to Use the Base64 Encoder/Decoder
The Base64 Converter encodes text and files into Base64 format and decodes Base64 strings back to their original form. Base64 encoding is widely used in web development, email attachments, data URIs, API authentication, and any context where binary data must be transmitted as text.
Encoding Text to Base64
Paste or type text in the input area and click Encode. The text "Hello, World!" encodes to "SGVsbG8sIFdvcmxkIQ==". Base64 uses the characters A-Z, a-z, 0-9, +, and /, with = for padding. The encoded output is always about 33% larger than the input.
Decoding Base64 to Text
Paste a Base64 string and click Decode to see the original text. "SGVsbG8sIFdvcmxkIQ==" decodes back to "Hello, World!". If the input is not valid Base64, the decoder will show an error message identifying where the invalid character occurs.
File Encoding
Upload an image, PDF, or any file to encode it as a Base64 string. This produces a data URI (data:image/png;base64,...) that can be embedded directly in HTML, CSS, or JSON. This technique eliminates additional HTTP requests for small assets, improving page load performance.
How Base64 Works
Base64 encoding converts every 3 bytes of input into 4 ASCII characters. Each character represents 6 bits of data (2⁶ = 64 possible values). If the input length is not a multiple of 3, padding characters (=) are added. The algorithm is standardized in RFC 4648.
Common Use Cases
Embedding images in HTML/CSS data URIs. Encoding binary data in JSON APIs. HTTP Basic Authentication (username:password encoded in Base64). Email attachments (MIME encoding). Storing binary data in XML or text-only formats. JWT token payloads use Base64URL encoding.
Frequently Asked Questions
Q: Is Base64 encryption?
A: No. Base64 is an encoding scheme, not encryption. It does not provide security. Anyone can decode a Base64 string instantly. Do not use Base64 to hide sensitive data like passwords. For security, use proper encryption algorithms like AES or RSA.
Q: Why does Base64 increase the data size?
A: Base64 represents 3 bytes using 4 characters, creating a 33% size increase. This overhead is the cost of encoding binary data as text. For small assets like icons, the overhead is negligible. For large files, binary transfer is more efficient.
Q: What is the difference between Base64 and Base64URL?
A: Standard Base64 uses + and / as characters, which have special meanings in URLs. Base64URL replaces + with - and / with _, making the encoded string safe for URLs and filenames without percent-encoding. JWT tokens use Base64URL encoding.