CodeCraft

Base64 Encode & Decode

Encode text to Base64 or decode Base64 to text. Supports file-to-Base64 conversion.

How to Use

  1. Select mode: Encode (text → Base64) or Decode (Base64 → text).
  2. Type in the left input box, or click Upload File to upload a file (up to 5MB).
  3. Click Encode → or Decode → to convert.
  4. The right panel shows the result. Click Copy to copy it to clipboard.

About Base64 Encoder & Decoder

Base64 is an encoding method that converts binary data into ASCII characters using 64 printable characters (A-Z, a-z, 0-9, +, /). Every 3 bytes of raw data are encoded as 4 Base64 characters, increasing size by ~33%. It is widely used in web development for embedding images as Data URIs, encoding file attachments in emails (MIME), and representing binary payloads in JSON-based protocols like JWT. Base64 is encoding, not encryption -- anyone can decode it. This tool supports both standard Base64 and URL-safe Base64 (using - and _ instead of + and /), with optional file-to-Base64 conversion. All processing happens locally in your browser.

Use Cases

Embed Images in HTML/CSS

Convert small images to Base64 data URIs for inline embedding, eliminating extra HTTP requests.

API Authentication

Encode credentials for HTTP Basic Auth headers (username:password → Base64).

Email Attachments (MIME)

Email protocols use Base64 to encode binary attachments within text-based MIME messages.

Data URL Schemes

Embed fonts, SVGs, or small assets directly in CSS/HTML using data:...;base64, prefixes.

Examples

Input
Hello, World!
Output
SGVsbG8sIFdvcmxkIQ==

Standard Base64 encoding of ASCII text. Each 3 bytes of input become 4 Base64 characters.

Input
SGVsbG8sIFdvcmxkIQ==
Output
Hello, World!

Decoding reverses the process. The '=' padding indicates the last group had fewer than 3 bytes.

Common Pitfalls & Edge Cases

  • ⚠Base64 increases data size by ~33%. Don't use it for large files where binary transfer is available.
  • ⚠Base64 is encoding, NOT encryption. It provides zero security — anyone can decode it.
  • ⚠URL-safe Base64 uses '-' and '_' instead of '+' and '/'. Make sure you use the right variant for URLs.
  • ⚠Line breaks in Base64 (e.g., MIME format with 76-char lines) must be stripped before decoding.

🔒 Data Privacy

All encoding and decoding runs entirely in your browser. Files are read locally via the File API and never uploaded to any server.

Standards & References

Frequently Asked Questions

Comments (0)

Leave a comment

0/2000