Free Developer Tool — 100% Client-Side

Base64 Encoder / Decoder

Encode or decode text and files to and from Base64 format instantly.

 
Sponsored
Advertisement

What Is Base64 Encoding?

Base64 is a binary-to-text encoding scheme that represents binary data in an ASCII string format. It is widely used for transmitting data over media that are designed to handle textual data. A Base64 encoder converts data into this format, while a Base64 decoder converts it back. Our free Base64 encoder online runs entirely in your browser for instant, private conversions.

Encode vs Decode

Encode

Converts text or binary data into a Base64 string. Useful for embedding data in HTML, CSS, or JSON, or for transmitting binary data through text-based protocols like HTTP.

Decode

Converts a Base64 string back to its original text or binary form. Useful for reading API payloads, decoding JWT tokens, or extracting embedded data from web pages.

Why Developers Use Base64

  • API Authentication — Basic Auth headers use Base64 encoded credentials.
  • Embedding Images — Convert images to Base64 data URIs for inline display in HTML or CSS.
  • JSON Payloads — Encode binary data as Base64 strings within JSON API payloads.
  • JWT Tokens — JSON Web Tokens use Base64url encoding for their header, payload, and signature.
  • Email Attachments — MIME encoding uses Base64 to transmit file attachments via email.

Common Use Cases

Base64 encoding is essential in modern web development. API developers use it daily for encoding request payloads, debugging authentication headers, and processing data from third-party services. Frontend developers use it to embed small images directly into CSS or HTML to reduce HTTP requests. Security professionals decode Base64 strings to inspect JWT tokens and API credentials during penetration testing.

How to Use This Base64 Tool

To encode text to Base64, type or paste your text into the input field and click Encode to Base64. To decode Base64 back to text, paste the encoded string and click Decode from Base64. The tool handles UTF-8 characters correctly, so emoji, non-Latin scripts, and special characters are all supported. Use the Copy button to copy the result to your clipboard.

Base64 Encoding Examples

Text → Base64

"Hello World" → SGVsbG8gV29ybGQ=

JSON → Base64

{"key": "value"} → eyJrZXkiOiAidmFsdWUifQ==
Sponsored
Advertisement
Technical Documentation & Standards

Technical Specifications & Standards Base64 is a binary-to-text encoding algorithm standardized by the Internet Engineering Task Force (IETF) in RFC 4648. It is designed to transport arbitrary binary payloads—such as images, compiled binaries, cryptographic signatures, and encrypted digests—over transport channels that only reliably support 7-bit or 8-bit ASCII characters (such as SMTP email per RFC 2045, HTTP headers, XML feeds, and JSON data structures). The standard Base64 alphabet consists of 64 printable characters: uppercase A–Z (indices 0–25), lowercase a–z (indices 26–51), digits 0–9 (indices 52–61), plus '+' (index 62) and '/' (index 63). When data is encoded, the output length increases by approximately 33% because every 3 binary octets (24 bits) are mapped to 4 6-bit Base64 characters, with '=' padding characters appended when the input byte length is not divisible by 3.

How It Works in Your Browser WebUtil's Base64 tool performs bidirectional encoding and decoding completely client-side in the browser. While legacy web engines relied on window.btoa() and window.atob(), these functions fail when encountering non-ASCII or multibyte UTF-8 characters (such as emojis or accented characters), throwing a DOMException. WebUtil solves this by implementing an RFC-compliant UTF-8 binary stream pipeline. Inputs are first encoded into a Uint8Array using the browser's native TextEncoder API. The binary stream is then translated 6 bits at a time into the Base64 alphabet. For file inputs, the HTML5 FileReader API reads uploaded files as an ArrayBuffer, converting binary blobs into Data URLs or raw Base64 strings instantly.

Developer Guide & Common Pitfalls Base64 encoding is widely misunderstood and misapplied across web architectures: - Base64 is not encryption: Base64 is an encoding format, not a security mechanism. It provides zero confidentiality and can be decoded instantly by anyone. Never use Base64 to hide passwords or secrets without prior encryption. - URL-safe Base64: Standard Base64 uses '+' and '/', which carry special syntactic meaning in URL query strings and URI paths. RFC 4648 Section 5 defines "Base64URL", which substitutes '-' for '+' and '_' for '/', while omitting '=' padding. - Bandwidth overhead: Storing high-resolution images as Base64 Data URIs directly inside HTML or CSS files increases network payload size by 33% and disables browser image caching across multiple pages. - Memory consumption: Encoding large files (>50MB) entirely in a browser tab can cause memory spikes. WebUtil uses streaming ArrayBuffers to maximize performance and prevent tab freezing.

Zero-Knowledge Privacy & Security Assurance Developers routinely convert proprietary assets, authentication headers (such as HTTP Basic Auth credentials), private certificates, and client-side files to Base64. WebUtil guarantees complete data privacy: all encoding and decoding logic runs locally within your browser tab. No binary data, credentials, or file payloads are ever transmitted to any remote server or third-party API.

How to Do This in Code

Deploy Your Next Project Fast

Get $200 free credit on DigitalOcean to deploy your apps with blazing-fast infrastructure.

Base64 Encoder / Decoder FAQ

What is Base64 encoding and why is it used?

Base64 encoding translates binary data into 64 ASCII characters so it can be safely transmitted across text-based protocols like HTTP, JSON, XML, and email without character corruption.

Is Base64 considered encryption or secure?

No. Base64 is strictly an encoding mechanism, not encryption. Anyone who intercepts a Base64 string can decode it back to original data instantly. Never rely on Base64 for data security—always use AES or RSA encryption for sensitive data.

Why does Base64 increase data size by ~33%?

Base64 represents 3 bytes (24 bits) of binary data using 4 ASCII characters (32 bits). This mathematical ratio causes an unavoidable 33% increase in data transfer size.

What is the difference between standard Base64 and Base64URL?

Standard Base64 uses '+' and '/' characters, which have special syntactic meanings in URLs and file systems. Base64URL replaces '+' with '-' and '/' with '_', and often omits '=' padding to make tokens URL-safe.

How do Data URIs work with Base64 in HTML and CSS?

A Data URI allows small images and fonts to be inlined directly into HTML or CSS using the syntax: data:image/png;base64,iVBORw0KGgo... This eliminates an extra HTTP request at the expense of caching efficiency.