Free Base64 Encoder & Decoder | OneStepToRank

Base64 Encoder & Decoder

Encode text to Base64 or decode Base64 back to plain text. Supports UTF-8 characters, runs entirely in your browser -- nothing is sent to a server.

Encode / Decode Base64

Dominate Local Search

Developer tools are just the start. OneStepToRank monitors your Google rankings 24/7 across your entire service area and automatically adapts your strategy to keep you on top.

Get Started Free

What Is Base64 Encoding?

Base64 is a binary-to-text encoding scheme that represents binary data as a string of printable ASCII characters. It uses a set of 64 characters -- the uppercase letters A through Z, lowercase a through z, digits 0 through 9, plus sign (+), and forward slash (/) -- to encode arbitrary bytes. The equals sign (=) is used for padding when the input length is not divisible by three. Base64 was originally designed for email (MIME) to safely transmit binary attachments over text-only protocols, but it has since become a fundamental tool in web development, APIs, and data storage.

Common Use Cases for Base64

Base64 encoding is used extensively in modern web development. Data URIs embed images, fonts, and other small assets directly in HTML or CSS, eliminating an HTTP request at the cost of approximately 33% larger file size. API authentication commonly uses Base64 -- HTTP Basic Auth encodes the username:password string in Base64 and sends it in the Authorization header. JSON payloads often include Base64-encoded binary data since JSON does not natively support binary. Email attachments in MIME format use Base64 to encode images, documents, and other files that travel alongside plain-text email content. It is important to note that Base64 is not encryption -- it is trivially reversible and provides no security whatsoever.

Base64 Encoding Table and Padding

The Base64 algorithm works by reading input in groups of 3 bytes (24 bits), then splitting those 24 bits into four 6-bit groups. Each 6-bit value maps to one of the 64 characters in the encoding table. When the input is not evenly divisible by 3, padding with = characters is added: one = if the input has one extra byte, or two == if it has two extra bytes. This ensures the encoded output is always a multiple of 4 characters long. A common variant, Base64url, replaces + with - and / with _, making the output safe for use in URLs and filenames without percent-encoding.

Frequently Asked Questions

What is Base64 encoding?
Base64 is a binary-to-text encoding scheme that converts binary data into a string of 64 printable ASCII characters. It was designed to safely transmit binary data over text-only channels like email. The encoding uses A-Z, a-z, 0-9, +, and / characters, with = for padding. It increases data size by about 33%.
When should I use Base64 encoding?
Common use cases include embedding images in HTML/CSS using data URIs, encoding binary attachments in email, sending binary data in JSON API payloads, HTTP Basic Authentication headers, and storing small binary values in text-based configuration files. Base64 is not encryption and provides no security -- never use it to hide sensitive data.
What are data URIs and how does Base64 relate to them?
A data URI embeds a file directly in HTML or CSS as an inline string instead of linking to an external file. The format is data:[mediatype][;base64],data. For example, a small PNG can be embedded as data:image/png;base64,iVBORw0KGgo... This eliminates an HTTP request but the Base64-encoded version is about 33% larger than the original file. Best used for small icons and images under a few kilobytes.
Does Base64 encoding work with non-English characters?
Yes, but you need to handle UTF-8 encoding properly. The JavaScript btoa() function only works with Latin-1 characters. To encode UTF-8 text (including emoji, Chinese, Arabic, etc.), you must first convert the string to UTF-8 bytes. This tool handles UTF-8 automatically, so you can encode and decode text in any language without worrying about character encoding issues.