Base64 एन्कोडर / डिकोडर

Base64 एन्कोडिंग से टेक्स्ट या फ़ाइलें एन्कोड और डिकोड करें।

Plain text
Base64
AI
Bulk mode Pro

What is Base64 एन्कोडर / डिकोडर?

Base64 is a binary-to-text encoding scheme that represents binary data using 64 printable ASCII characters (A-Z, a-z, 0-9, +, /). It is used throughout web development, email, cryptography, and data transmission to safely transport binary data through channels that only support text. Our Base64 encoder and decoder converts between raw text and Base64 encoded strings instantly, with no size limits and full Unicode support.

Base64 is encoding, not encryption. It does not protect data from being read — it simply changes its representation. Any Base64 string can be decoded back to the original data by anyone with access to the string. It is used for compatibility reasons: embedding images in HTML as data URIs, encoding API credentials for HTTP Basic Authentication, transmitting binary files over email using MIME, and storing binary blobs in JSON or XML that can only contain text.

Understanding Base64 is fundamental to modern web development. JWT tokens, data URIs, Basic Auth headers, SAML assertions, and PEM certificate files all use Base64 encoding. A developer who cannot quickly encode or decode Base64 strings wastes time writing one-off scripts or searching for the right command-line flags. Our tool makes this instant and accessible from any browser.

Use Cases

Here are the most common ways people use Base64 एन्कोडर / डिकोडर every day.

API Authentication Headers

HTTP Basic Authentication transmits credentials as "username:password" Base64-encoded in the Authorization header: Authorization: Basic dXNlcjpwYXNzd29yZA==. Use the encoder to generate the correct header value for manual API testing with curl or Postman without needing to write code. Use the decoder to read and verify credentials from an existing Authorization header when debugging authentication issues.

Embedding Images in HTML and CSS

Small images — icons, logos, inline SVGs — can be embedded directly in HTML or CSS as data URIs using Base64 encoding: src="data:image/png;base64,...". This eliminates an HTTP request for small assets that would otherwise require a separate file. The trade-off is a larger HTML file size (Base64 increases size by ~33%). For icons under 1KB, the request elimination benefit usually outweighs the size cost. Our encoder handles this use case directly.

JWT Token Inspection

JSON Web Tokens consist of three Base64URL-encoded segments separated by dots: header.payload.signature. The header and payload contain JSON data that can be decoded without the secret key. Use our decoder on the first two segments (before and between the dots) to inspect the token's algorithm, issuer, subject, claims, issued-at time, and expiration — essential for debugging JWT authentication issues without needing a specialized JWT inspector.

Email Attachment Encoding

Email protocols (SMTP, IMAP) transmit binary files as Base64 within MIME multipart message format because email infrastructure was designed for 7-bit ASCII text. Images, PDFs, and documents attached to emails are Base64-encoded in the raw email source. Understanding this encoding is essential for writing email-sending code, debugging email delivery issues, and parsing raw email messages in data processing pipelines.

Configuration and Secret Storage

Base64 encoding is commonly used to store binary data in environment variables and configuration files that only support text. TLS certificates (PEM format), SSH keys, binary tokens, and binary configuration values are Base64-encoded for storage in .env files and Kubernetes Secrets. kubectl get secret outputs Base64-encoded values by default — our decoder is a quick way to inspect the underlying data without piping through base64 -d on the command line.

Examples

Example 1

Encode API Credentials

Create an HTTP Basic Auth header value from username and password.

Input admin:secretpassword123
Output YWRtaW46c2VjcmV0cGFzc3dvcmQxMjM=
Example 2

Decode JWT Payload

Decode the second segment of a JWT to inspect its claims.

Input eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIn0=
Output {"sub":"1234567890","name":"John Doe"}
Example 3

Encode JSON for URL

Encode a JSON object as Base64 for use in a cookie or URL parameter.

Input {"userId": 42, "role": "admin"}
Output eyJ1c2VySWQiOiA0MiwgInJvbGUiOiAiYWRtaW4ifQ==

Tips for Using Base64 एन्कोडर / डिकोडर

  • Base64 increases data size by ~33% — a 1MB image becomes ~1.33MB encoded. Account for this when embedding images inline.
  • Base64URL (used in JWTs) replaces + with - and / with _ for URL-safe output. Standard Base64 and Base64URL are not interchangeable.
  • Kubernetes secrets store data as Base64. Use the decoder to inspect secret values: echo "dmFsdWU=" | base64 -d — or use our tool.
  • Never assume Base64 data is private. It is trivially reversible. Treat a Base64 string with the same sensitivity as its decoded contents.
  • PEM certificate files (.pem, .crt) are Base64-encoded DER certificates wrapped in -----BEGIN CERTIFICATE----- headers.

Frequently Asked Questions

Is Base64 the same as encryption?

No. Base64 is an encoding scheme — it changes the representation of data but provides zero confidentiality. Anyone can decode a Base64 string back to the original data in milliseconds using any Base64 decoder. Encryption, by contrast, transforms data into ciphertext that cannot be reversed without the correct key. Never use Base64 to protect sensitive data. Use encryption (AES-256, RSA, TLS) for confidentiality and Base64 only for compatibility — encoding binary data for text-only transmission channels.

Why does Base64 end with "=" padding?

Base64 encodes 3 bytes of input (24 bits) into 4 Base64 characters (4 × 6 bits = 24 bits). If the input length is not divisible by 3, padding characters "=" are added to make the encoded string's length divisible by 4. One "=" means one byte of padding was added; "==" means two bytes. Some applications (like JWTs and Base64URL) omit padding since the decoder can infer the length from the string length. Standard Base64 always includes padding.

What is the difference between Base64 and Base64URL?

Standard Base64 uses the characters A-Z, a-z, 0-9, + and /. The + and / characters are special in URLs — they encode to %2B and %2F in percent-encoding, making standard Base64 strings in URLs awkward. Base64URL was designed for URLs: it replaces + with - and / with _ to produce strings that are safe in URL paths, query strings, and filenames without percent-encoding. JWT tokens, OAuth tokens, and URL parameters use Base64URL.

Why does Base64 make data 33% larger?

Base64 converts every 3 bytes (24 bits) of input into 4 characters (each representing 6 bits). The ratio is 4/3 ≈ 1.33, so every 3 bytes becomes 4 characters — a 33% size increase regardless of the data content. This overhead is the cost of binary-to-text encoding. When planning storage or bandwidth for Base64-encoded content, multiply the original binary size by 1.34 to estimate the encoded size (the extra 0.01 accounts for possible padding and newlines).

Can Base64 encode any type of data?

Yes. Base64 can encode any binary data: images, audio, video, executables, compressed archives, cryptographic keys, and arbitrary byte sequences. The encoding is content-agnostic — it treats all input as raw bytes. For text input, the tool first converts to UTF-8 bytes then Base64-encodes those bytes. For non-ASCII text (Chinese, Arabic, emoji), this means the Base64 string encodes the UTF-8 byte representation, not the original Unicode code points.

What is a data URI and how does Base64 enable it?

A data URI is a URI scheme that embeds data directly in the URI string rather than pointing to an external resource: data:[mediatype][;base64],data. For example: src="data:image/png;base64,iVBORw0KGgo...". The base64 parameter indicates that the data portion is Base64-encoded rather than percent-encoded plain text. Data URIs allow embedding images, fonts, and other assets directly in HTML or CSS without separate HTTP requests, which can improve page load performance for small assets.