JustConvertAll-in-One Convert

Base64 Encoder

Encode any text to Base64 instantly online. Free Base64 encoder with full UTF-8 and Unicode support. No signup required.

Related Tools

Advertisement

Base64 is a binary-to-text encoding scheme standardized in RFC 4648 that represents arbitrary binary data using 64 printable ASCII characters (A–Z, a–z, 0–9, +, /). It was designed to safely transmit binary content over channels that only support text, such as SMTP email, which predates modern binary-safe protocols.

Base64 is ubiquitous in modern systems: HTTP Basic Authentication headers, JWT tokens, CSS data URIs for inline images, PEM-encoded TLS certificates, and XML/JSON payloads embedding binary attachments all rely on Base64 encoding. It adds roughly 33% size overhead in exchange for universal text compatibility.

This tool encodes text to Base64 in the browser using the TextEncoder API (converts the input string to UTF-8 bytes first) followed by btoa(). The UTF-8 pre-processing step ensures non-ASCII characters — emoji, accented letters, CJK characters — encode correctly, avoiding the btoa() Unicode limitation.

Common Use Cases

Embedding images in CSS

When bundling small icons or background images into a CSS stylesheet, designers encode the raw PNG or SVG bytes as Base64 and embed them as data URIs (data:image/png;base64,...). This eliminates extra HTTP requests for small assets. Tools like webpack's url-loader do this automatically for files under a configurable size threshold.

HTTP Basic Auth headers

The HTTP Basic Authentication scheme requires credentials formatted as Base64(username:password) inside the Authorization header. When manually crafting API requests — for example, testing a Jenkins or Nexus Repository API with curl — you need to encode the credential pair before inserting it into the header string.

Encoding binary in JSON payloads

REST APIs and GraphQL mutations that accept file uploads via JSON (rather than multipart/form-data) require binary content encoded as Base64 strings. AWS Lambda function invocations, SendGrid email attachments, and Twilio MMS payloads all use this pattern to embed file bytes inside a JSON body.

Storing binary data in environment variables

CI/CD pipelines (GitHub Actions, GitLab CI, CircleCI) store secrets like service account JSON files, TLS private keys, and signing certificates as Base64 strings in environment variables. The raw binary or JSON with special characters would break shell parsing; the Base64 form is a safe single-line string.

How to Use the Base64 Encoder

  1. Paste or type any text in the left panel.
  2. The Base64-encoded output appears instantly in the right panel.
  3. Click "Copy Output" to copy the result to your clipboard.
  4. Use "Load Example" to see a sample encoding.
  5. Click "Clear" to reset both panels.

What is Base64?