Encoding Tools

Base64 Encoder

Convert text to Base64 for transport, embeds, and quick debugging.

Base64 output

RW5jb2RlIHRoaXMgZGV2ZWxvcGVyIG5vdGUu

Understand the format

How Base64 Encoder works

Base64 re-expresses arbitrary bytes using 64 printable characters, so binary or awkward text survives channels that only accept plain ASCII.

The mechanics: three bytes become four characters

Base64 takes the input three bytes at a time, which is 24 bits, and splits those bits into four groups of six. Each 6-bit group indexes into a 64-character alphabet of A-Z, a-z, 0-9, plus and slash. When the input length is not a multiple of three, the final group is padded with one or two equals signs so the output length stays a multiple of four.

The consequence is a predictable 33% size increase: every three bytes in produce four characters out. That overhead is the price of passing binary data through email headers, JSON string values, HTML attributes, and other places where raw bytes would be mangled.

Text has to become bytes first

Base64 encodes bytes, not characters, so any text must first be turned into bytes by a character encoding. This page uses UTF-8, which is what virtually every modern API expects. It matters for anything outside ASCII: the five-character string "héllo" is six bytes in UTF-8 because é occupies two bytes, and its Base64 form is aMOpbGxv rather than what a one-byte-per-character encoding would produce.

It is worth stating plainly, because it is the single most common misunderstanding: Base64 is an encoding, not encryption. Anyone can decode it instantly without a key. Encoding a password or an API key does not protect it in any way.

Step by step

How to use Base64 Encoder

  1. Type or paste the plain text you want to encode into the left panel.
  2. Read the Base64 output on the right; it updates as you type.
  3. Copy the output, taking care not to introduce line breaks if the destination is an HTTP header.
  4. If the target system expects the URL-safe alphabet, replace + with - and / with _ before use.

Encoding uses the browser TextEncoder and btoa in the page. Values you paste, including credential-shaped strings, are never sent to a server.

Worked examples

Base64 Encoder examples explained

HTTP Basic authentication credentials

Input

user:pa55word

Result

dXNlcjpwYTU1d29yZA==

This is exactly what an Authorization: Basic header carries. It is encoded for transport only, which is why Basic auth requires HTTPS.

Non-ASCII text through UTF-8

Input

héllo

Result

aMOpbGxv

Five characters, six UTF-8 bytes, eight Base64 characters. The first four output characters, aMOp, encode the bytes 68 c3 a9, where c3 a9 is the two-byte UTF-8 form of é.

Reference

How Base64 turns three bytes into four characters

How Base64 turns three bytes into four characters
Input bytesBitsBase64 outputPadding
M a n (3 bytes)24 bits split into four 6-bit groupsTWFuNone needed
M a (2 bytes)16 bits padded to 18TWE=One = character
M (1 byte)8 bits padded to 12TQ==Two = characters
AlphabetA-Z a-z 0-9 + /64 symbols, 6 bits eachURL-safe variant swaps + / for - _

Practical Guide

How teams use Base64 Encoder

Common use cases

  • Prepare header values, fixtures, and payload fragments for demo requests and test harnesses.
  • Convert values for systems that expect a Base64 wrapper, such as data URIs or config secrets.
  • Inspect how text changes before embedding it in an auth or transport flow.

Checks before trusting the result

  • Base64 is reversible encoding, never encryption or obfuscation that resists inspection.
  • Check whether the receiving system expects the URL-safe alphabet instead of the standard one.
  • Watch for hidden whitespace and line wrapping when pasting encoded output into headers or config files.

Troubleshooting

Common mistakes and how to fix them

Encoding a secret and treating the result as protected.
Decoding requires no key. Use TLS in transit and a secret manager at rest; Base64 only makes the value transport-safe.
Pasting encoded output that has been wrapped at 76 characters into a header.
MIME wraps lines by design, but HTTP headers must be a single line. Strip the newlines before use.
Encoding a whole JSON document and wondering why the size jumped.
The 33% overhead applies to everything. Encode only the fragment that genuinely needs it.

FAQ

Base64 Encoder questions, answered

Is Base64 secure?

No, and it is not intended to be. It is a transport encoding defined in RFC 4648. Anyone can reverse it, so it provides no confidentiality whatsoever.

Why does the output end in one or two equals signs?

Padding. Base64 emits four characters per three input bytes, so inputs whose length is not a multiple of three are padded to keep the output length a multiple of four.

What is URL-safe Base64?

A variant from RFC 4648 section 5 that replaces + with - and / with _, because the standard characters have meaning inside URLs. Padding is often dropped as well. JSON Web Tokens use this variant.

How much larger does the data get?

About 33%, plus padding. Four output characters for every three input bytes, before any line-break overhead.

Can I Base64 an image here?

This panel encodes text. For binary files, encode the bytes with a tool that reads the file directly, otherwise the character encoding step will corrupt the data.

Go deeper

Specifications and guides