मुख्य सामग्री पर जाएँ
FreeOnlineTools Go
हिन्दी
explanation

Base64 एन्कोडिंग क्या है? एक संपूर्ण व्याख्या

By FreeOnlineTools Team · Updated 2026-09-02

Quick Answer

Base64 एन्कोडिंग binary डेटा को 64 छपने योग्य अक्षरों (A-Z, a-z, 0-9, +, /) से टेक्स्ट में बदलता है। हर 3 byte input 4 Base64 अक्षर बनता है। Base64 उलटने योग्य (एन्क्रिप्शन नहीं) है और डेटा ~33% बढ़ाता है। हमारे मुफ्त Base64 Encoder/Decoder से बदलें।

Introduction

Base64 एक binary-to-text एन्कोडिंग स्कीम है जो binary डेटा को 64 छपने योग्य अक्षरों के साथ ASCII स्ट्रिंग में बदलता है। यह RFC 4648 द्वारा परिभाषित है और email अटैचमेंट (MIME), Data URLs, JWT टोकन भाग और binary डेटा वाले JSON payload में व्यापक उपयोग होता है। Base64 एन्कोडिंग है, एन्क्रिप्शन नहीं —पूरी तरह उलटने योग्य, कोई key नहीं चाहिए।

Step by Step

  1. Understand the character set

    Base64 uses 64 characters: A-Z (26), a-z (26), 0-9 (10), + and / (2). The = character is used for padding when the input length is not a multiple of 3. The URL-safe variant replaces + with - and / with _ and omits padding.

  2. Learn how encoding works

    Base64 processes input in 3-byte (24-bit) blocks. Each 24-bit block is split into four 6-bit groups. Each 6-bit value (0-63) maps to one of the 64 characters. If the input is not a multiple of 3, padding (=) is added: 1 byte input → 2 Base64 chars + ==, 2 bytes → 3 chars + =.

  3. Understand the size overhead

    Base64 increases data size by approximately 33% — every 3 bytes becomes 4 characters. A 1 MB file becomes ~1.33 MB when Base64-encoded. This overhead is the trade-off for text-only compatibility.

  4. Distinguish encoding from encryption

    Base64 is encoding, not encryption. It is reversible without a key — anyone can decode it. Base64 provides no confidentiality; it only converts binary to text for transport. Never use Base64 to store passwords or secrets.

Examples

Encode text

Input: Hello, World!

Output: SGVsbG8sIFdvcmxkIQ==

Encode binary data (shown as hex)

Input: Bytes: 0x00 0x01 0x02

Output: AAEC

URL-safe Base64 (JWT style)

Input: Standard: SGVsbG8= → URL-safe: SGVsbG8 (no padding, - and _ for + and /)

Output: Used in JWT tokens and URL parameters

Common Problems

  • Treating Base64 as encryption —Base64 is reversible without a key. Anyone can decode it. Never use it to protect sensitive data.
  • Non-ASCII characters —naive btoa() throws on Unicode. Use TextEncoder + btoa(unescape(encodeURIComponent(text))) or a UTF-8-aware tool.
  • Padding removal —the = padding is part of the encoding. Removing it breaks decoding (though some decoders can reconstruct it).
  • Size overhead —Base64 adds ~33% to data size. For large files, this is significant; consider whether encoding is necessary.

Tips

  • Use Base64 for Data URLs to embed small images in HTML/CSS without a separate HTTP request.
  • Use URL-safe Base64 (replace + with -, / with _, strip padding) for URLs and JWT tokens.
  • Base64 is not encryption —use it for transport compatibility, not for confidentiality.
  • Use our Base64 Encoder and Decoder for instant, private conversion in your browser.

Related Tools

Related Guides

References