Encoding Tools

Base64 Encoder / Decoder

Encode and decode Base64 strings online. Supports text, URL-safe mode, and file encoding with instant results.

Your data never leaves your browser — nothing is sent to any server.

Encode
0 chars
0 chars
How to use
  1. 1

    Select your mode

    Choose Encode to convert text to Base64, or Decode to convert Base64 back to text. Use the switch button to toggle between modes.

  2. 2

    Enter or paste your input

    Type or paste text into the input area. The output updates in real time as you type — no submit button needed.

  3. 3

    Enable URL-safe mode if needed

    Toggle URL-safe mode to produce output compatible with URLs, file names, and JWT tokens. This replaces + with -, / with _, and removes = padding.

  4. 4

    Upload a file for binary encoding

    Click Upload File to encode binary files like images, PDFs, or documents. Files up to 5 MB are supported. The encoded output appears instantly.

  5. 5

    Copy the result

    Click the copy button next to the output area to copy the result to your clipboard. A confirmation toast appears when the copy succeeds.

Common errors

Invalid Base64 input

Ensure the input contains only valid Base64 characters (A–Z, a–z, 0–9, +, /, =). Remove any extra whitespace, line breaks, or non-Base64 characters. If you're decoding a URL-safe string, enable the URL-safe toggle first.

Garbled or mojibake output when decoding

The original text was likely encoded with a different character encoding (e.g., Latin-1 instead of UTF-8). This tool decodes using UTF-8. If the source used a different encoding, you may need to convert the encoding separately.

File too large (over 5 MB)

Split the file into smaller chunks before encoding, or use a command-line tool like base64 for large files. Browser-based encoding has memory constraints, and very large files can freeze the tab.

FAQ (6)
What is Base64 encoding?

Base64 is a binary-to-text encoding scheme that represents binary data as an ASCII string. It uses 64 characters (A–Z, a–z, 0–9, +, /) to represent 6 bits of data each, plus = for padding. It increases data size by roughly 33% but ensures safe transport through text-only channels like email, JSON, and URLs.

What is URL-safe Base64?

URL-safe Base64 replaces + with - and / with _, and removes trailing = padding. Standard Base64 characters + and / have special meaning in URLs and file paths, so URL-safe encoding avoids issues when Base64 strings are used in query parameters, file names, or JWT tokens.

Can I encode binary files like images or PDFs?

Yes. Use the Upload File button to select any file up to 5 MB. The tool reads the file as binary data and produces the Base64-encoded output. This is commonly used for embedding images in CSS data URIs, sending files in JSON APIs, or storing binary content in databases that only accept text.

Why does my Base64 decoding fail?

Decoding fails when the input is not valid Base64. Common causes include extra whitespace or line breaks, missing padding characters (= signs), characters outside the Base64 alphabet, or using standard Base64 input with URL-safe mode enabled (or vice versa). Ensure the input matches the encoding mode selected.

Is Base64 encoding the same as encryption?

No. Base64 is an encoding, not encryption. It does not provide any security — anyone can decode a Base64 string without a key. It is designed for data transport compatibility, not confidentiality. If you need to protect sensitive data, use proper encryption algorithms like AES or RSA before encoding.

Does this tool handle Unicode and emoji?

Yes. The encoder properly handles multi-byte Unicode characters including emoji, accented characters, CJK scripts, and other non-ASCII text. It uses UTF-8 encoding internally before applying Base64 transformation, ensuring lossless round-trip conversion for any valid Unicode string.

Learn more

Base64 Encoding and Decoding: A Complete Technical Guide

Base64 is one of the most widely used binary-to-text encoding schemes in software development. Defined in RFC 4648, it transforms arbitrary binary data into a subset of ASCII characters that can be safely transmitted through text-based protocols. Every web developer, backend engineer, and DevOps professional encounters Base64 regularly — in data URIs, API payloads, email attachments, authentication tokens, and configuration files.

How Base64 Encoding Works

The encoding process takes three bytes (24 bits) of input at a time and splits them into four groups of 6 bits each. Each 6-bit group maps to one of 64 printable ASCII characters: uppercase A–Z (values 0–25), lowercase a–z (26–51), digits 0–9 (52–61), plus sign + (62), and forward slash / (63). When the input length is not divisible by three, one or two = padding characters are appended to the output to signal the decoder how many bytes to discard. This deterministic mapping means Base64 always increases data size by approximately 33% — three input bytes become four output characters.

URL-Safe Base64 Variant

Standard Base64 uses + and / characters that conflict with URL encoding, file system conventions, and certain data formats. The URL-safe variant, also defined in RFC 4648 Section 5, substitutes - for + and _ for /, and typically omits the trailing = padding. This variant is essential for JWT (JSON Web Tokens), OAuth tokens, URL query parameters, and any context where the encoded string appears in a URI. Many modern APIs and authentication systems use URL-safe Base64 exclusively.

Common Use Cases for Base64

Data URIs embed images, fonts, and other assets directly in HTML and CSS using Base64-encoded content, eliminating extra HTTP requests for small assets. Email systems rely on Base64 through the MIME standard to encode binary attachments — every PDF, image, and ZIP file sent via email is Base64-encoded. API integrations frequently use Base64 for binary payloads in JSON, since JSON has no native binary type. HTTP Basic Authentication encodes username:password pairs in Base64 for the Authorization header. Configuration management tools like Kubernetes Secrets store sensitive values as Base64-encoded strings in YAML manifests.

Base64 and Unicode Text

Encoding Unicode text (characters outside the ASCII range) requires an intermediate step. The text must first be converted to bytes using a character encoding — almost always UTF-8 — before the binary-to-Base64 transformation. This tool handles UTF-8 conversion automatically, supporting the full Unicode range including emoji, CJK characters, Arabic, Cyrillic, and combining diacritical marks. Decoding reverses the process: Base64 to bytes, then UTF-8 bytes to Unicode text.

Base64 File Encoding

Encoding files to Base64 is common when embedding assets in source code, sending files through APIs that accept only text, or storing binary content in text-based databases and configuration systems. Images under a few kilobytes are good candidates for data URI embedding; larger files should generally be served as separate resources to avoid inflating document size. This tool supports file uploads up to 5 MB, covering the vast majority of use cases for icons, thumbnails, certificates, and small documents.

Base64 Is Not Encryption

A critical misconception is that Base64 provides security. It does not. Base64 is a reversible encoding — anyone can decode it without any key or secret. Never use Base64 alone to protect passwords, API keys, personal data, or any sensitive information. For confidentiality, use proper cryptographic algorithms (AES-256, ChaCha20) and established libraries. Base64 may be used as a transport encoding after encryption, but the encoding step itself adds zero security.

Performance Considerations

The 33% size overhead of Base64 matters for large payloads and high-throughput systems. A 1 MB binary file becomes approximately 1.33 MB when Base64-encoded. For bandwidth-sensitive applications, consider binary protocols (gRPC, Protocol Buffers, MessagePack) or multipart form uploads instead of Base64-encoded JSON. In-browser encoding of very large files can also cause memory pressure and UI freezes, which is why this tool limits file uploads to 5 MB — more than sufficient for most development and debugging tasks.