Base64 Encoder & Decoder
Encode or decode Base64 strings instantly. Runs in your browser — nothing is sent to any server.
Need more developer tools?
Check out the full OGPix toolkit — OG image generator, favicon maker, JWT decoder, and more. All free.
Browse All Tools →What Is Base64 Encoding?
Base64 is a binary-to-text encoding scheme that represents binary data using 64 printable ASCII characters (A-Z, a-z, 0-9, +, /). It is commonly used to embed images in HTML/CSS, transmit binary data in JSON or XML, encode email attachments (MIME), and store binary data in text-only environments like configuration files or URLs.
How This Tool Works
Paste any text into the input field and the tool instantly encodes it to Base64 using the standard alphabet. Switch to Decode mode to convert Base64 strings back to plain text. For files, simply drag and drop — the file is read locally using the FileReader API and its binary content is converted to a Base64 string. All processing happens in your browser using btoa(), atob(), and TextEncoder/TextDecoder for full UTF-8 support.
Base64 Encoding vs. Encryption
Base64 is not encryption. It does not provide any security or confidentiality. Anyone can decode a Base64 string back to its original content. It is purely a data representation format — useful for safely transmitting binary data through text-based protocols, but not for protecting sensitive information.
UTF-8 and Base64
The JavaScript btoa() function only handles Latin-1 characters. To properly encode UTF-8 strings (including emojis, CJK characters, and other multi-byte characters), this tool first converts the string to UTF-8 bytes using TextEncoder, then encodes those bytes to Base64. Decoding reverses the process using TextDecoder.
Frequently Asked Questions
Is my data safe?
Yes. All encoding and decoding happens entirely in your browser. No data is ever sent to a server. You can verify this by disconnecting from the internet and using the tool offline.
Can I encode files (images, PDFs, etc.)?
Yes. Drag and drop any file onto the input area or click "upload a file." The tool reads the file locally and outputs its Base64 representation. This is useful for embedding images in CSS or HTML data URIs.
Does it handle Unicode / emojis?
Yes. Unlike basic implementations that break on multi-byte characters, this tool uses TextEncoder/TextDecoder to properly handle any UTF-8 string, including emojis and characters from any language.
What is the maximum input size?
There is no hard limit, but very large inputs (over 10 MB) may be slow since everything runs in the browser. For most use-cases — encoding API tokens, embedding small images, or decoding JWT payloads — performance is instant.
What is the Swap button?
The Swap button takes the current output, moves it to the input field, and toggles the mode. For example, if you just encoded some text, clicking Swap will switch to Decode mode with the Base64 string as input, letting you verify the round-trip.