Skip to content

Base64 encode

EncodeExperimentalLimited support. Verify anything critical.

Base64 encode is a utility that securely converts human-readable UTF-8 text into a 64-character ASCII alphabet (A-Z, a-z, 0-9, +, and /) with equals-sign padding. You can use it to package strings and binary data so they survive transmission through systems that only accept 7-bit ASCII, like HTTP headers, APIs, or legacy email gateways. Privacy Guarantee: All encoding processing happens entirely locally within your browser. Your text and data never leave your device and are never uploaded to any external server, guaranteeing complete privacy for your information.

Skip to the tool

This tool processes text on your device. The text is not uploaded.

  • Encodes UTF-8 text or files up to 25 MB. File bytes are read into browser memory.
  • Do not paste production secrets you cannot rotate.

How to use Base64 encode

What is Base64 encode?

Base64 encode is a utility that securely converts human-readable UTF-8 text into a 64-character ASCII alphabet (A-Z, a-z, 0-9, +, and /) with equals-sign padding. You can use it to package strings and binary data so they survive transmission through systems that only accept 7-bit ASCII, like HTTP headers, APIs, or legacy email gateways. Privacy Guarantee: All encoding processing happens entirely locally within your browser. Your text and data never leave your device and are never uploaded to any external server, guaranteeing complete privacy for your information.

Technical overview and RFC 4648 standard

Base64 is a fundamental binary-to-text encoding algorithm standardized in RFC 4648. Its primary purpose is to transport arbitrary byte sequences reliably across text-oriented transmission channels without risking data corruption from unprintable characters or encoding mismatches.

The standard Base64 alphabet comprises exactly 64 characters:

  • A through Z (indices 0 to 25)
  • a through z (indices 26 to 51)
  • 0 through 9 (indices 52 to 61)
  • + (index 62)
  • / (index 63)
  • = (special padding character used at the end)

Algorithmic mechanics: 24-bit to 6-bit chunking

The encoder processes input bytes in sequential 3-byte (24-bit) tuples. Here is how the transformation functions:

  1. Bit grouping: Three 8-bit bytes (24 bits total) are concatenated into a single 24-bit buffer.
  2. 6-bit division: The 24-bit buffer is partitioned into four distinct 6-bit integers (4 chunks of 6 bits = 24 bits).
  3. Table lookup: Each 6-bit integer (ranging from 0 to 63) maps directly to its corresponding character in the Base64 index table.
  4. Padding alignment:
    • If 1 byte remains (8 bits), it is padded with four zero bits to yield two Base64 characters, followed by two padding characters (==).
    • If 2 bytes remain (16 bits), they are padded with two zero bits to yield three Base64 characters, followed by one padding character (=).
Practical developer use cases

Base64 encoding is a foundational building block in modern web development and software engineering:

  • HTTP Basic Authentication: Passing credentials securely in headers, formatted as Authorization: Basic <base64(username:password)>.
  • Inline Data URIs: Embedding small SVG icons, WOFF fonts, or images directly within HTML or CSS (e.g., data:image/svg+xml;base64,...) to minimize network requests.
  • Web API Payloads & JWTs: Transporting binary cryptographic signatures, tokens, or binary structures safely within JSON bodies without escape character issues.
  • Email Attachments (MIME): Encoding binary attachments for reliable SMTP delivery across different mail gateways.
  • Kubernetes & Cloud Configuration: Storing secrets or certs in YAML manifests, where values are expected to be Base64-encoded.
Best practices
  • Handle UTF-8 text properly: When encoding text using JavaScript, always encode multi-byte Unicode characters properly (like emojis or international text) utilizing TextEncoder before converting the output to Base64.
  • Use URL-safe Base64 for links: Standard Base64 uses + and /, which have special meaning in URLs. If passing Base64 strings in query parameters, ensure you employ a URL-safe Base64 implementation (which replaces + with - and / with _).
  • Avoid encoding large files inline: Embedding data URIs saves HTTP requests but increases file size by roughly 33% and negatively affects asset caching. Use it sparingly for very small files under a few kilobytes.
Security considerations

Base64 is not encryption. It is a public, deterministic data representation format that provides no confidentiality. Anyone can decode a Base64 string instantly.

  • Never rely on Base64 to “hide” or secure sensitive data like passwords, API keys, or personally identifiable information (PII).
  • When dealing with secrets, encrypt the data using strong cryptographic algorithms (such as AES) first, and then apply Base64 encoding only to package the encrypted bytes for transport.
Code examples

Here is how you can perform Base64 encoding programmatically using standard libraries in various languages:

JavaScript / TypeScript (Modern Web Standards)

function encodeBase64(text: string): string {
  const bytes = new TextEncoder().encode(text);
  const binary = Array.from(bytes, (byte) => String.fromCharCode(byte)).join("");
  return btoa(binary);
}

Python 3

import base64

def encode_base64(text: str) -> str:
    return base64.b64encode(text.encode("utf-8")).decode("ascii")

Go

package main

import (
    "encoding/base64"
    "fmt"
)

func main() {
    text := "Trendalyzer"
    encoded := base64.StdEncoding.EncodeToString([]byte(text))
    fmt.Println(encoded)
}

How it works

  1. Enter what you haveType or pick your text. Nothing is submitted anywhere.
  2. It runs in this tabThe calculation happens on your device, using your browser's own data.
  3. Take the resultRead the text, then copy, download, or share a link.

Reimplemented locally. Not derived from IT-Tools source.

Basis
independent
Licence
MIT
Last reviewed

Frequently asked questions

Is Base64 encoding a form of encryption?

No. Base64 is an open, deterministic binary-to-text representation scheme (RFC 4648). It provides zero confidentiality, as anyone can decode it instantly without a cryptographic key.

Why does Base64 output sometimes end with one or two equals signs (=)?

The equals sign is padding. Base64 processes data in 3-byte (24-bit) blocks. When the input length is not divisible by 3, one or two '=' characters pad the output to maintain 4-character alignment.

What is the size overhead of Base64 encoding?

Base64 expands data by approximately 33% (4 output ASCII characters for every 3 input bytes), plus optional padding characters.

How does this tool handle international Unicode characters?

The tool encodes multi-byte UTF-8 code points directly into byte sequences before applying the 6-bit ASCII transformation, ensuring full support for non-Latin alphabets and emojis.

Navigation

Type to search…

↑↓ navigate↵ selectEsc close