Base64 Encoder and Decoder [2025]

Tool rating: 0 people found this tool terrific

Encode and decode text and binary data using Base64. Supports both standard Base64 and URL-safe Base64, handles Unicode characters, and provides options for dealing with invalid input.

✓ Standard and URL-Safe✓ Unicode Support✓ Invalid Character Handling

Text Input

Base64 Output

About Base64

Base64 is a binary-to-text encoding scheme that represents binary data in a printable ASCII string format. It's commonly used to encode data that needs to be transmitted over media designed to handle text, such as email or URLs.

The standard Base64 alphabet uses 64 characters: A-Z, a-z, 0-9, +, and /. URL-safe Base64 replaces + and / with - and _, respectively, and may omit padding characters.

Key Features

  • Encode text and binary data to Base64 format.
  • Decode Base64-encoded strings back to their original form.
  • Support for both standard Base64 and URL-safe Base64.
  • Handles Unicode characters correctly.
  • Option to preserve or remove invalid characters during decoding.
  • Clear error messages for invalid Base64 input.
  • Example data for quick testing of different scenarios.
  • Copy encoded and decoded results to the clipboard.

Common Use Cases

Data Transmission

  • • Email attachments
  • • Data URIs
  • • Embedding images in HTML/CSS

Web Development

  • • Storing binary data in cookies
  • • URL encoding
  • • API data exchange

General Use

  • • Data serialization
  • • Representing binary data in text files
  • • Basic obfuscation (not for security)

Frequently Asked Questions

What is Base64?

Base64 is an encoding scheme that converts binary data into an ASCII string format using 64 different characters. It's designed to make binary data safe for text-based systems.

What is URL-safe Base64?

URL-safe Base64 is a variation of Base64 that replaces the '+' and '/' characters with '-' and '_', respectively. It also often omits the padding '=' characters. This makes the encoded string safe to use in URLs.

How does Base64 handle padding?

Base64 uses '=' characters for padding at the end of the encoded string to ensure that the output length is a multiple of 4. This tool automatically handles padding during encoding and decoding.

How are invalid characters handled during decode?

If preserve is enabled, the converter will skip over characters that aren't part of the expected base64 alphabet and attempt to decode the rest. If it is disabled, it will raise an exception.

Is Base64 encryption?

No, Base64 is an encoding scheme, not encryption. It provides no security and is easily reversible. It's meant for data representation, not confidentiality.

Is my data secure?

All processing happens in your browser. No data is sent to any server.

Technical Details

Base64 Alphabet

The standard Base64 alphabet consists of:

  • • A-Z (uppercase letters)
  • • a-z (lowercase letters)
  • • 0-9 (digits)
  • • + and / (symbols)
  • • = (padding character)

URL-Safe Base64 Alphabet

The URL-safe Base64 alphabet consists of:

  • • A-Z (uppercase letters)
  • • a-z (lowercase letters)
  • • 0-9 (digits)
  • • - and _ (symbols)

Encoding Process:

  1. The input data is converted into a stream of bytes.
  2. The byte stream is grouped into sets of 3 bytes (24 bits).
  3. Each 24-bit group is divided into four 6-bit groups.
  4. Each 6-bit group is mapped to a character in the Base64 alphabet.
  5. If the input is not a multiple of 3 bytes, padding ('=') is added.

Decoding Process:

  1. The input data is converted to base64 with padding.
  2. Each Base64 character is converted to its 6bit binary representation.
  3. The binary data is concatenated.
  4. The concatenated binary data is converted back into octets.
  5. Each octet is represented as a UTF-8 character.

Comments

No comments yet

Be the first to share your thoughts! Your feedback helps us improve our tools and inspires other users. Whether you have suggestions, ideas, or just want to show your appreciation - we'd love to hear from you.

More Data Tools

ASCII to CSV Converter

Convert ASCII table format to CSV files

Base32 Decoder/Encoder

Decode or encode Base32 data

Base58 Decoder/Encoder

Decode or encode Base58 data

Base58 to Hexadecimal Converter

Convert Base64 encode to hexadecimal format

Base64 to ASCII Converter

Convert Base64 encode to ASCII format

Base64 to Binary Converter

Convert Base64 encode to binary format

Base64 to CSV Converter

Convert Base64 encode to CSV files

Base64 to Decimal Converter

Convert Base64 encode to decimal format

Base64 to Hexadecimal Converter

Convert Base64 encode to hexadecimal format

Base91 Decoder/Encoder

Decode or encode Base91 data

Binary to Base64 Converter

Convert binary to Base64

Binary to Decimal Converter

Convert binary to decimal

Binary to Gray Code Converter

Convert binary to gray code

Binary to Hexadecimal Converter

Convert binary to hexadecimal

Binary to Octal Converter

Convert binary to octal

CSV to ARFF Converter

Convert CSV files to ARFF format for ML tasks

CSV to ASCII Converter

Convert CSV files to ASCII tables

CSV to Base64 Converter

Convert CSV files to Base64 format

CSV to DOC (Word) Converter

Convert CSV files to DOC format for MS Word

CSV to HTML Converter

Convert CSV files to HTML tables and code

CSV to JPG Converter

Convert CSV files to JPG images

CSV to JSON Converter

Convert CSV files to JSON format

CSV to SQL Converter

Convert CSV files to SQL code

CSV to TSV Converter

Convert CSV files to TSV format

CSV to XLSX Converter

Convert CSV files to XLSX (Excel) format

CSV to XML Converter

Convert CSV files to XML format

CSV to XML Converter

Convert CSV files to YAML format

Decimal to ASCII Converter

Convert decimal to ASCII

Decimal to Binary Converter

Convert decimal to binary

Decimal to Gray Code Converter

Convert decimal to gray code

Decimal to Hexadecimal Converter

Convert decimal to hex

Decimal to Octal Converter

Convert decimal to octal

Decimal to Roman Converter

Convert decimal to Roman numerals

Gray Code to Binary Converter

Convert gray code to binary

Gray Code to Decimal Converter

Convert gray code to decimal

Gray Code to Hexadecimal Converter

Convert gray code to hexadecimal

Gray Code to Octal Converter

Convert gray code to octal

Hexadecimal to Base58 Converter

Convert hexadecimal to Base58 encoding

Hexadecimal to Binary Converter

Convert hexadecimal to binary

Hexadecimal to Decimal Converter

Convert hexadecimal to decimal

Hexadecimal to Gray Code Converter

Convert hexadecimal to gray code

Hexadecimal to Octal Converter

Convert hexadecimal to octal

JSON to CSV Converter

Convert JSON code to comma-separated value (CSV) files

JSON to HTML Converter

Convert JSON code to HTML table code

JSON to Markdown Converter

Convert JSON code to Markdown tables

JSON to SQL Converter

Convert JSON code to SQL

JSON to Table Converter

Convert JSON code to a table

JSON to TSV Converter

Convert JSON code to TSV

JSON to XLSX Converter

Convert JSON code to XLSX (Excel)

Number Base Converter

Convert between decimal, binary, hex, and octal

Octal to Binary Converter

Convert octal to binary

Octal to Decimal Converter

Convert octal to decimal

Octal to Gray Code Converter

Convert octal to gray code

Octal to Hexadecimal Converter

Convert octal to hexadecimal

Punycode to Unicode Converter

Convert punycode to unicode

SQL to CS ConverterV

Convert SQL code to CSV files

SQL to HTML Converter

Convert SQL code to HTML tables

SQL to JSON Converter

Convert SQL code to JSON

SQL to Table Converter

Convert SQL code to a table

SQL to XLSX Converter

Convert SQL code to XLSX file

SQL to XML Converter

Convert SQL code to XML

SQL to YAML Converter

Convert SQL code to YAML

TSV to CSV Converter

Convert TSV format to CSV file

TSV to JSON Converter

Convert TSV format to JSON

TSV to SQL Converter

Convert TSV format to SQL code

TSV to XLSX Converter

Convert TSV format to Excel file

TSV to XML Converter

Convert TSV format to XML

TSV to YAML Converter

Convert TSV format to YAML

Unicode to Punycode Converter

Convert unicode to punycode

URL Encoder/Decoder

Encode and decode URLs

XLSX to CSV Converter

Convert XLSX to CSV file format

XLSX to HTML Table Converter

Convert XLSX files to HTML tables

XLSX to JSON Converter

Convert XLSX files to JSON

XLSX to TSV Converter

Convert XLSX to TSV file format

XLSX to XML Converter

Convert XLSX files to XML

XLSX to YAML Converter

Convert XLSX files to YAML

XML to CSV Converter

Convert XML code to CSV file format

XML to SQL Converter

Convert XML to a SQL

XML to Table Converter

Convert XML to a table

XML to TSV Converter

Convert XML to a TSV file

XML to XLSX Converter

Convert XML to a XLSX file

YAML Converter

Convert between YAML and other formats

YAML to CSV Converter

Convert YAML to CSV file format

YAML to XLSX Converter

Convert YAML to XLSX file format