Free Online Base64 Encoder / Decoder
Encode text to Base64 or decode Base64 back to readable text
Try these next
Why use Base64 Encoder / Decoder
- Full Unicode support -- emojis, CJK, and accented text encode correctly where most Base64 tools break on non-Latin input.
- Byte size display shows encoding overhead before you commit to inlining something in a payload.
- Swap button verifies round-trip integrity without copy-paste gymnastics.
How it works
Encoding converts your text to a UTF-8 byte sequence using the TextEncoder API, then passes those bytes through the btoa() function, which maps every group of 3 bytes to 4 Base64 characters from the alphabet A-Z, a-z, 0-9, +, /. If the input byte count is not divisible by 3, one or two padding characters (=) are appended to round the output to a multiple of 4 characters. This is why encoded output is always roughly 33% larger. Decoding reverses the process: atob() maps each group of 4 Base64 characters back to 3 bytes, then TextDecoder interprets the bytes as a UTF-8 string. The Unicode-safe wrapper is necessary because the native btoa() only accepts Latin-1 characters and would throw on multi-byte sequences without the TextEncoder intermediary.
About this tool
Paste text, get Base64. Paste Base64, get text. That's it. This handles the full UTF-8 range -- emojis, CJK, accented characters -- using a TextEncoder approach that most browser-native btoa() tools break on. Base64 shows up everywhere: JWTs, HTTP Basic auth headers, Kubernetes secrets, data URIs, CI/CD environment variables. When you're staring at an opaque string from an OAuth provider or a CI log and need to know what's inside, decode it here and move on. The byte size display is useful when you need to check whether an inline SVG data URI will blow past a CSP limit or whether a Kubernetes secret exceeds the 1 MB etcd value cap. A swap button lets you verify round-trip integrity without copy-pasting between fields. Encoding overhead is always ~33% -- three bytes in, four characters out -- so plan your payload budgets accordingly.
How to use Base64 Encoder / Decoder
- Pick Encode or Decode. Select the Encode tab to convert text to Base64, or Decode to turn Base64 back into readable text.
- Paste your input. Drop your text or Base64 string into the input area. Output updates in real time -- no button click needed.
- Check the byte size. Both input and output show their byte size so you can see the ~33% overhead at a glance.
- Copy or swap. Copy the result, or use Swap to send it back to the input for round-trip verification.
Use cases
- Your CI pipeline is spitting out Base64-encoded error logs. Paste the blob, decode it, find the stack trace.
- You need to embed a small SVG as a data URI in a React component. Encode the SVG, check the byte count is under your CSP limit, copy the output.
- A Kubernetes secret YAML requires Base64 values. Encode the database password here, paste it into the manifest, done.
- The middle segment of a JWT is just Base64. Decode it to check the claims without installing jwt.io or writing a script.
- You're building a Basic Auth header manually for a cURL command. Encode username:password and prepend 'Basic '.
Frequently Asked Questions
Base64 converts binary data into a text string using 64 ASCII characters (A-Z, a-z, 0-9, +, /). It's used to embed images in HTML/CSS (data URIs), send binary attachments in email (MIME), and pass binary data through text-only channels like JSON or XML. The encoded output is about 33% larger than the original.
Base64 uses 6 bits per character to represent 8 bits of data. Every 3 bytes of input become 4 characters of output, a 33% increase. Additionally, padding characters (=) are appended to make the output length a multiple of 4. For example, the 13-byte string 'Hello, World!' becomes the 20-character Base64 string 'SGVsbG8sIFdvcmxkIQ=='.
The browser's native btoa() function only handles Latin-1 characters. This tool uses a Unicode-safe approach (TextEncoder + btoa) that correctly handles emojis, CJK characters, accented letters, and any other Unicode text. The result decodes back to the original text perfectly.
A data URI embeds Base64-encoded content directly in HTML or CSS using the format data:[mediatype];base64,[data]. For example, a small PNG image can be inlined as an <img> src instead of referencing an external file. This reduces HTTP requests but increases HTML size by about 33%.
No. Base64 is an encoding, not encryption. Anyone can decode a Base64 string -it provides no security whatsoever. It's purely a format conversion for transporting binary data as text. Never use Base64 to 'protect' sensitive data like passwords or API keys.
Each Base64 character represents a 6-bit value. To decode, convert each character to its 6-bit binary value using the Base64 alphabet (A=0, B=1, ..., Z=25, a=26, ..., z=51, 0=52, ..., 9=61, +=62, /=63). Concatenate the bits, then split into 8-bit bytes and convert to characters. In practice, just use this tool -it's instant.
This tool encodes and decodes text strings. To encode a binary file like an image, you would need a tool that accepts file uploads -this one handles text only. If you want to create a Base64 data URI from an image, most browsers let you do this via the File API in the developer console, or you can use an online image-to-Base64 converter.
Base64 encodes 3 bytes at a time into 4 characters. When the input length is not a multiple of 3, padding characters (= or ==) are added to make the output a multiple of 4 characters. One = means 1 byte of padding was needed; == means 2 bytes. The padding is required by the Base64 standard for correct decoding, though some implementations omit it.
Standard Base64 uses + and / as the 62nd and 63rd characters, which are unsafe in URLs. Base64url replaces + with - and / with _ to produce a URL-safe string that does not need percent-encoding. JWTs (JSON Web Tokens) use Base64url for their header and payload segments. If you are decoding a JWT, paste the segment into this tool -most Base64 decoders handle both variants.
Related Tools
Discover more free utilities to enhance your productivity.