Base64 Encoder Decoder

Encode and decode Base64 strings online. Supports UTF-8 text, file uploads, and URL-safe Base64 variants. 100% client-side — your data never leaves your browser.

  1. Home
  2. Encoder & Decoder
  3. Base64 Encoder & Decoder
100% client-side No data uploaded
0 chars | 0 bytes UTF-8

Drop a file here or click to choose a file

Format: .txt, .json • Max size: 10MB

0 chars
0 chars | 0 bytes UTF-8

Drop a file here or click to choose a file

Format: .txt, .json • Max size: 10MB

URL-safe variants (-, _, missing padding) and whitespace are handled automatically.

0 chars

Ctrl+Enter convert Ctrl++C copy

What can you do with Base64?

API Payloads

Encode text or binary data for transmission in JSON or form API payloads.

Data URIs

Embed small images directly in HTML or CSS as data:image/base64 data URIs.

Authentication

Work with HTTP Basic Authentication, which encodes username:password in Base64.

Email & MIME

Handle Base64-encoded binary email attachments transmitted over MIME.

Kubernetes

Decode Base64-encoded Secret values stored in Kubernetes manifests.

JWTs & Tokens

Inspect and build JWT payloads and other token-based formats (URL-safe Base64).

What is Base64 Encoding?

Base64 is a binary-to-text encoding scheme that converts binary data into a printable ASCII string format. It uses 64 characters (A-Z, a-z, 0-9, +, and /) to represent binary data in a human-readable way. Base64 encoding is widely used to transmit data safely across systems that may not handle binary data well.

The term "Base64" comes from the fact that the encoding uses a base-64 numeral system to represent 6 bits of data using each character. Every 3 bytes (24 bits) of input are encoded into 4 Base64 characters (each representing 6 bits). This means that Base64-encoded data is approximately 33% larger than the original binary data.

Base64 encoding works by taking the binary representation of the input data and grouping it into 6-bit chunks. Each 6-bit chunk is then converted to its corresponding Base64 character. If the input data is not a multiple of 3 bytes, padding characters (=) are added to make the output valid.

When Should You Use Base64 Encoding?

Base64 encoding is useful in various scenarios:

  1. Data Transmission Over Text-Based Protocols: When transmitting binary data over protocols like HTTP, SMTP, or JSON that expect text, Base64 encoding ensures the data remains intact.
  2. Email Attachments: Email systems traditionally work with text, so binary attachments are encoded in Base64 for transmission.
  3. Data URLs: Embedding images directly in HTML or CSS as data URLs requires Base64 encoding.
  4. API Requests and Responses: Many REST APIs use Base64 to encode binary data in JSON payloads.
  5. Configuration Files: Storing binary data or sensitive information in configuration files often requires Base64 encoding.
  6. Authentication Tokens: HTTP Basic Authentication uses Base64 to encode username and password credentials.
  7. URL-Safe Transmission: URL-safe Base64 (replacing + and / with - and _) is used when encoding needs to be included in URLs or query strings.
  8. Password Hashing Variants: Some password hashing algorithms use Base64 for encoding the hash output.

Base64 Padding

Base64 encoding requires the output length to be a multiple of 4 characters. If the input data length is not a multiple of 3, padding characters (=) are added to the end of the encoded string. The number of padding characters depends on the input length:

  • If input length ÷ 3 has remainder 0: No padding needed
  • If input length ÷ 3 has remainder 1: Two == padding characters added
  • If input length ÷ 3 has remainder 2: One = padding character added

Base64 vs. Encryption

Important: Base64 is NOT an encryption method. It is merely an encoding scheme that converts data into a different format. Anyone can easily decode Base64-encoded data back to its original form. If you need to protect sensitive data, use proper encryption algorithms like AES-256 instead of relying on Base64 encoding alone.

Base64 vs Base64URL

Base64URL is the variant used when encoded values must appear in URLs, query strings, filenames, or JWT tokens. It swaps the two characters that have special meaning in URLs and drops the padding.

Feature Base64 Base64URL
+ character Yes No (-)
/ character Yes No (_)
= padding Usually included Optional (usually omitted)
URL / query string safe No Yes
JWT / OAuth tokens No Yes

How to Use This Base64 Encoder/Decoder

  1. Choose your mode — Click the toggle switch to select Encode (text → Base64) or Decode (Base64 → text).
  2. Enter or upload your data — Type or paste text directly into the input area, or upload a .txt or .json file (max 10MB). The result updates in real time as you type.
  3. Adjust options (optional) — Enable "URL-safe Base64" to replace + and / with - and _ for use in URLs and tokens, or "Remove padding" to strip the trailing = characters.
  4. Convert — The result updates automatically. You can also click Encode or Decode, use Swap to exchange input and output, or press Ctrl+Enter.
  5. Copy, download or clear — Use the copy button to copy the result, Download .txt to save it, or Clear All to reset. Press Ctrl++C to copy the result quickly.

Frequently Asked Questions

What is the difference between Base64 encoding and decoding?

Base64 encoding converts binary or text data into a Base64 ASCII string, while Base64 decoding reverses the process, converting a Base64 string back to its original binary or text form.

Why is Base64-encoded data larger than the original?

Base64 encodes every 3 bytes of input into 4 ASCII characters, resulting in approximately 33% size increase. This overhead is the trade-off for making binary data safely transmittable over text-only protocols.

Is Base64 encoding secure for sensitive data?

No. Base64 is not encryption — it is simply an encoding scheme. Anyone can decode Base64 data instantly without a key. Always use proper encryption (e.g. AES-256) for sensitive information.

What is URL-safe Base64 and when should I use it?

URL-safe Base64 replaces + with - and / with _ to avoid characters that have special meaning in URLs. Use it when embedding Base64 in query strings, tokens, or filenames.

Why does Base64 output sometimes end with = or ==?

The = characters are padding added when the input length is not a multiple of 3 bytes. One = is added for 2 bytes of remainder, two == for 1 byte. This ensures the output length is always a multiple of 4.

Last updated: 17 Aug 2026