OnSumo Tools

Base64 Encoder / Decoder

This tool converts text to Base64 and Base64 back to text entirely in your browser. Paste a string and get its Base64 representation, or paste a Base64 string and get back the original content. No data leaves your device. The tool supports standard Base64 (RFC 4648), URL-safe Base64, and handles UTF-8 multi-byte characters correctly. It is free, requires no login, and works offline once the page loads.

Mode

Output

Standard

Input 11 chars → Output 16 chars

Base64 is encoding, not encryption. Anyone with the string can decode it. Do not use Base64 to hide secrets.

How this tool works

The Base64 encoder converts binary or text data to and from Base64 encoding, where every 3 bytes of input are represented as 4 printable ASCII characters drawn from the 64-character alphabet (A-Z, a-z, 0-9, +, /), with = padding to align output to a multiple of 4 characters. The URL-safe variant replaces + with - and / with _ to produce Base64 strings safe for use in URLs and query parameters without percent-encoding. The tool handles both standard Base64 and Base64url, auto-detecting which encoding is present during decoding. For text inputs, encoding runs on the UTF-8 byte representation, not on raw code-point values, so multi-byte characters (emoji, Chinese characters, Arabic text) encode correctly. All encoding and decoding runs entirely in the browser; no data is sent to any server, which matters when the input contains API keys, credentials, or other sensitive values. Key assumption: Base64 is an encoding scheme, not encryption. Base64-encoded data is fully reversible without any key. Edge case: Base64 encoding increases output size by approximately 33% (4 output bytes per 3 input bytes). For inline image data URIs embedded in CSS or HTML, this size increase can significantly affect page weight. A 100KB image becomes a ~133KB Base64 string.

Worked example

"Hello World" encodes to SGVsbG8gV29ybGQ=. URL-safe swaps + and / for - and _ and drops padding. MIME wraps the same payload at 76 characters per line.

Related tools

Frequently asked questions

  • What is the difference between Base64 and Base64url?

    Standard Base64 uses + and / as the 63rd and 64th characters, with = for padding. Base64url replaces + with - and / with _, and typically omits padding. Base64url is used in JWTs, URL parameters, and filenames because +, /, and = have special meanings in URLs and file systems. This tool supports both variants. Select \\\\\\\"URL-safe\\\\\\\" mode to use the Base64url alphabet.

  • Is my data sent to a server?

    No. All encoding and decoding runs in your browser's JavaScript engine. No network requests are made with your data. You can confirm this by watching the Network tab in your browser's DevTools while using the tool. This is important when encoding API keys, passwords, tokens, or any credentials.

  • Why does Base64 make the output larger?

    Base64 represents 3 bytes of input as 4 ASCII characters. That is a 33% size increase. This overhead exists because Base64 uses only 64 characters (6 bits per character), while binary data uses 256 possible values per byte (8 bits). The tradeoff is that Base64 output is safe to transmit through systems that only handle text, such as email (MIME), JSON, XML, and HTTP headers.

  • Can I encode binary files like images or PDFs?

    Yes, if you provide the binary content. In the browser version, you can drag and drop a file onto the input area and the tool will read it as binary and produce the Base64 output. For large files (over 1 MB), the encoding may take a moment because the browser needs to read the entire file into memory.

  • How do I know if a string is valid Base64?

    Valid standard Base64 contains only characters A-Z, a-z, 0-9, +, /, and optionally ends with one or two = padding characters. The length of a valid Base64 string (excluding whitespace) is always a multiple of 4. If the decoder reports an error, the input contains characters outside this set or has an incorrect length.

  • What happens with UTF-8 characters like emoji?

    The browser's btoa() function only handles ASCII (code points 0-255). This tool first encodes your text to UTF-8 bytes using TextEncoder, then Base64-encodes those bytes. The decoder reverses the process: Base64-decode to bytes, then TextDecoder to UTF-8 text. This means emoji and characters from any language encode and decode correctly.