Text Tools

Base64 Encoder & Decoder

Convert plain text, code, and Unicode into standard or URL-Safe Base64 strings, or decode Base64 back into readable text. 100% private in-browser processing.

Base64 Encoder & Decoder

Encode arbitrary UTF-8 text into Base64 format or decode valid Base64 strings back to readable characters. Supports standard Base64 (RFC 4648), URL-safe variations (- and _), and custom line chunking.

Mode:
Load Sample:
Base64 Format & Encoding Configuration
0
Input Chars
Character length
0 B
Input Bytes
UTF-8 byte size
0
Output Chars
Output length
0 B
Output Bytes
Output byte size
0%
Size Ratio
Output / Input ratio
0
Padding Chars
Trailing '=' count
Encoder
Active Mode
Current operation
100% In-Browser Privacy • No Data Uploaded

How to Use the Online Base64 Encoder & Decoder

Follow these 5 simple steps to convert plain text into Base64 format or decode encoded Base64 strings:

1
Select Encoder or Decoder Mode

Click Encode to Base64 to convert plain text into a Base64 string, or click Decode Base64 to decode an existing Base64 string into readable text.

2
Enter or Paste Text

Type, paste, or upload your text or Base64 code into the left input textarea. Full Unicode, multi-line strings, and accented characters are supported.

3
Configure Encoding Options

Choose between Standard RFC 4648 (with + and /) or URL-Safe Base64 (with - and _), line wrapping (64/76 chars), and padding behavior.

4
Real-Time Instant Preview

With Live Auto-Process enabled, results calculate immediately as you type. Or click the primary Encode / Decode button to execute manually.

5
Copy or Download Result

Click Copy to copy the output to your clipboard, or click Download to export the content as a base64-encoded.txt or base64-decoded.txt file.

6
Analyze Byte & Size Stats

Inspect the live statistics grid showing exact character counts, UTF-8 byte sizes, size expansion ratios (~133%), and padding counts.

How Base64 Encoding Works: The 24-Bit to 4-Character Mechanism

Base64 is a binary-to-text encoding scheme that represents binary data in an ASCII string format by translating it into radix-64 representation. Here is the mathematical process:

The 3-Byte to 4-Character Conversion Algorithm

Base64 divides binary data into 6-bit chunks. Because computers store data in 8-bit bytes, the algorithm takes 3 input bytes (24 bits total) and divides them into 4 groups of 6 bits:

  • Input: 3 bytes = 3 × 8 = 24 bits.
  • Division: 24 bits ÷ 6 = 4 characters.
  • Lookup: Each 6-bit value (0 to 63) maps to a character in the Base64 alphabet (A–Z, a–z, 0–9, +, /).
  • Padding (=): If the input byte length is not divisible by 3, 1 or 2 padding characters (=) are added to complete the 4-character block.
Standard Base64 vs. URL-Safe Base64 Variants

Standard Base64 uses characters that have reserved syntactic meaning in URLs and file systems:

  • Standard Base64 (RFC 4648 §4): Uses + (plus) and / (slash). In URLs, + can be interpreted as a space, and / as a path separator.
  • URL-Safe Base64 (RFC 4648 §5): Replaces + with - (hyphen) and / with _ (underscore).
  • JWT Tokens: JSON Web Tokens (JWT) strictly use unpadded URL-Safe Base64 (Base64URL).
  • Our Tool: Supports both variants with 1-click toggling!
Important Security Notice: Base64 is NOT Encryption

Base64 is strictly a data representation format designed to safely transport binary data across media designed for text (such as email via SMTP or HTTP headers). It does not encrypt data and provides zero confidential protection. Anyone can decode a Base64 string in milliseconds without any secret key or password. Never use Base64 as a method to protect passwords, API keys, or sensitive customer records.

The Base64 Index Table (RFC 4648)

The 64 printable ASCII characters used to represent 6-bit binary values from 0 to 63:

Value Character Value Character Value Character Value Character
0A 16Q 32g 48w
1B 17R 33h 49x
2C 18S 34i 50y
3D 19T 35j 51z
4E 20U 36k 520
5F 21V 37l 531
6G 22W 38m 542
7H 23X 39n 553
8I 24Y 40o 564
9J 25Z 41p 575
10K 26a 42q 586
11L 27b 43r 597
12M 28c 44s 608
13N 29d 45t 619
14O 30e 46u 62+ (or -)
15P 31f 47v 63/ (or _)

Frequently Asked Questions (FAQ)

Authoritative answers to common questions regarding Base64 encoding, character sets, and standards:

Base64 is a binary-to-text encoding format that translates raw bytes into a sequence of 64 printable ASCII characters (A-Z, a-z, 0-9, +, /). It is widely used in email (MIME), HTTP headers, data URIs, and authentication tokens to ensure binary data is safely transmitted without being modified or corrupted by text-based network protocols.

Base64 operates on 3-byte blocks (24 bits) to produce 4-character outputs. If the input data is not an exact multiple of 3 bytes, padding is required. If 1 byte is left over, the output ends with ==. If 2 bytes are left over, the output ends with =. If the input is an exact multiple of 3 bytes, no equals signs are added.

No, absolutely not. Base64 is merely a public encoding scheme. It involves no secret keys, passwords, or cryptographic hashing. Anyone who encounters a Base64 string can decode it instantly back to its original plain text. It must never be used to protect sensitive data or passwords.

Standard browser btoa() throws an exception when given non-ASCII characters. Our tool uses modern standard TextEncoder and TextDecoder to convert text into full UTF-8 byte streams before Base64 conversion. This guarantees flawless encoding and decoding of accented letters, Cyrillic, Arabic, Chinese, Japanese, Devnagari, and modern emojis.

Standard Base64 uses + and /, which have special syntax in URLs and query strings. URL-Safe Base64 (RFC 4648 §5) substitutes - (hyphen) for + and _ (underscore) for /, and often omits padding equals signs. This allows the string to be placed directly in web URLs without percent-encoding.

Base64 increases data size by approximately 33% (a 4:3 expansion ratio). Because 3 raw bytes (24 bits) require 4 ASCII characters (32 bits) to represent, the output is always roughly one-third larger than the raw binary input.

Base64 decoding fails if the input contains characters outside the allowed alphabet (such as $, %, #), if the character count is not valid, or if the decoded binary bytes do not represent valid UTF-8 text (such as decoding a raw image or encrypted file as plain text).

Yes. Our decoder automatically detects missing padding characters and normalizes the string length to a multiple of 4 before decoding, allowing you to seamlessly decode both padded and unpadded Base64 strings.

In MIME email transmission and PEM certificate files, long Base64 strings are wrapped into fixed-length lines of 64 or 76 characters separated by line breaks. You can select this option in our configuration drawer to format your output according to these specifications.

Your text is 100% private. All encoding and decoding operations happen directly within your web browser using client-side JavaScript. No text, tokens, or outputs are ever transmitted over the internet or logged to any database.

Yes! Clicking the Swap Input & Output button automatically copies the output result into the input box and switches the active mode from Encoder to Decoder (or vice versa), allowing effortless round-trip verification.

URL percent-encoding replaces individual reserved characters with a percent sign and two hex digits (e.g., space becomes %20) while leaving alphanumeric text unchanged. Base64 transforms the entire byte stream into an entirely new 6-bit representation.
Action completed successfully