Size Preview
{{ outputBytes.toLocaleString() }} bytes
Input {{ inputBytes.toLocaleString() }} B ×{{ sizeRatio }}
Input text / file
Base64-encoded text
Recent Encodes
  • {{ h }}

Introduction:

Base 64 encoding converts binary data into an ASCII-only string by mapping every three input bytes to four readable characters. The scheme was designed for email and XML systems that reject non-text bytes, yet it now underpins image embedding, data URIs, and token generation across many protocols.

This tool accepts plain text or an entire file, splits the incoming bytes into 24-bit blocks, and emits their Base 64 representation. Optional switches let you remove “=” padding, use URL-safe symbols, or wrap lines at 64 characters; instant copy, download, and a local history streamline repetitive tasks.

For example, a developer embedding a small SVG icon in CSS can drop the file, select the URL-safe toggle, and paste the result directly into a `background-image` rule, ensuring cross-browser portability without external requests.

Technical Details:

Concept Overview

Base 64 treats the input as a stream of eight-bit octets (b0…bn). It concatenates them into 24-bit chunks, re-segments each chunk into four six-bit indices, then looks up those indices in the 64-character alphabet. Padding bytes ensure the final block reaches 24 bits, preserving round-trip reversibility.

Core Process

input=b0b1b2 chunk=input»0 {6-bit alphabet

The default alphabet is A–Z, a–z, 0–9, +, /. The URL-safe variant substitutes - for + and _ for /.

Interpretation

OptionEffect
StandardUses “+” and “/”, adds “=” padding.
URL-safeReplaces symbols to avoid reserved URL bytes.
No paddingOmits trailing “=”, reducing length.
WrappedInserts newline every 64 characters for e-mail bodies.

Padding guarantees the output length is a multiple of four; removing it shortens tokens but may break strict decoders.

Variables & Parameters

  • input – plain text or binary file content.
  • url_safe – boolean; swaps “+”/“/” with “-”/“_”.
  • no_padding – boolean; strips trailing “=” bytes.
  • wrap – boolean; inserts newline every 64 characters.

Worked Example

Assumptions & Limitations

  • Assumes UTF-8 text when reading strings.
  • File inputs processed entirely in-browser memory-bound.
  • URL-safe variant remains case-sensitive.
  • Line wrapping fixed at 64 characters by convention.

Edge Cases & Error Sources

  • Zero-byte files return an empty string.
  • Extremely large files may exceed browser memory.
  • Non-UTF-8 text may mis-encode multibyte glyphs.
  • Removing padding can break some legacy decoders.

Scientific Validity & References

Concept formalised in RFC 4648, building on MIME Base 64 definitions from RFC 2045 and privacy-enhanced mail standards.

Privacy & Compliance

No personal data leaves the browser, simplifying GDPR alignment.

Step-by-Step Guide:

Follow these steps to transform any text or file into a shareable Base 64 string.

  1. Paste text or drop a file into the input box.
  2. Toggle URL-safe or No padding as needed.
  3. Choose Wrap to break long lines.
  4. Review the size preview for approximate output length.
  5. Press Ctrl + Enter or click Copy to place the result on your clipboard.
  6. Select Download to save the encoded text as a file.

FAQ:

Is my data stored?

All processing happens locally; nothing is uploaded or logged.

Why remove padding?

Omitting “=” shortens tokens for URLs where trailing symbols are trimmed; ensure the receiver supports this variant.

What does URL-safe mean?

It swaps “+” and “/” with “-” and “_” so the string remains safe inside paths and query parameters.

How long is my history kept?

The last ten encodings persist in browser storage until you clear them or purge site data.

Does wrapping affect decoding?

No. Newlines are ignored by compliant decoders and serve only for readability in emails or console logs.

Glossary:

Alphabet
Set of 64 printable characters used by the scheme.
Padding
“=” bytes added to complete a 24-bit block.
URL-safe
Variant replacing “+” and “/” with unreserved symbols.
Line wrap
Insertion of newline every 64 characters.
Local storage
Browser-side key-value store preserving recent encodes.

No data is transmitted or stored server-side; files are processed entirely in your browser.