Find your next tool

Browse tools or search by task

Explore JSONToonPro

Encoding & Decoding Tools

Base64 Encode Online – Text to Base64 Encoder

Encode text and Unicode strings to Base64 online. Copy standard Base64 output instantly and keep every character private with client-side processing.

Runs locally in your browser. Nothing you paste is uploaded.

Base64 Encode workspace
Text Input
0 chars
Base64 Output
Result appears here...

How Base64 Encoding Works

Enter text to encode its UTF-8 bytes as Base64. Copy the generated text for a transport format that expects Base64. Encoding preserves data in a different alphabet; it does not make confidential text unreadable to other people.

Text to Base64 Examples

The text Hi encodes to SGk=, and Hello encodes to SGVsbG8=. Unicode text is first converted to UTF-8 bytes. Preserve case in the output because uppercase and lowercase Base64 characters have different values.

Base64 Padding and the RFC 4648 Alphabet

The standard alphabet uses letters, digits, plus and slash. Padding uses equals signs when the input byte length is not a multiple of three. Base64URL substitutes different characters for plus and slash and may omit padding.

Base64 vs Encryption and Hashing

Encryption requires a key and provides confidentiality when used correctly. Hashing produces a digest that is not a reversible representation. Base64 can be decoded without a key, so it is not suitable for protecting secrets.

Where Base64 Encoding Is Used

Base64 appears in data URIs, binary fields inside JSON and email encodings. It increases byte length by roughly one third before surrounding syntax. Use the form required by the destination rather than assuming standard and URL-safe encodings are interchangeable.

More examples and technical details

How Base64 Encoding Works

Base64 solves a very specific problem: moving arbitrary bytes through a channel that only accepts printable text. The trick is to stop thinking in bytes and start thinking in 6 bit chunks. Twenty-four bits divide evenly by both 8 and 6, so the encoder reads the input three bytes at a time (24 bits), slices that block into four groups of 6 bits, and turns each group into one character from a fixed 64 character alphabet.

Because three input bytes always become four output characters, the result is exactly four thirds the original size, an increase of roughly 33 percent before padding and line breaks are counted. That overhead is the price of safe transport, and it is why you should encode only when the destination genuinely cannot carry raw bytes.

  1. Read the next three bytes of input, giving 24 bits.
  2. Split those 24 bits into four groups of 6 bits each.
  3. Read each 6 bit group as a number from 0 to 63.
  4. Look up that number in the Base64 alphabet to get one character.
  5. Repeat until the input runs out, then apply the padding rules.

Worked Example: Encoding "Man"

The word Man is three ASCII characters, so it forms exactly one complete 24 bit block with nothing left over. That makes it the cleanest possible demonstration.

Input: M a n
ASCII: 77 97 110
Bits: 01001101 01100001 01101110
 
Joined: 010011010110000101101110
Regrouped: 010011 010110 000101 101110
Values: 19 22 5 46
Alphabet: T W F u
 
Output: TWFu

Result: Man encodes to TWFu, three bytes in, four characters out, no padding needed.

Padding Rules Explained

Real input rarely has a length that is a multiple of three. When the final block is short, the encoder pads the remaining bits with zeros, emits the characters it can, and then appends equals signs so the output length stays a multiple of four. Decoders use that count to work out how many bytes to throw away.

Man (3 bytes) -> TWFu no padding
Ma (2 bytes) -> TWE= one = means the last group carried 2 bytes
M (1 byte) -> TQ== two = means the last group carried 1 byte

You will never see three equals signs in valid Base64, because a leftover of three bytes is simply a full block. A single stray equals sign in the middle of a string is a reliable sign that two encoded values were concatenated by mistake.

Where Base64 Encoding Is Used

  • Data URIs. Small icons and fonts embedded directly in CSS or HTML as data:image/png;base64,... so the browser makes no extra request.
  • Email attachments. MIME uses Base64 because SMTP was designed for 7 bit text and would corrupt raw binary.
  • JWT segments. The header and payload of every JSON Web Token are Base64URL encoded JSON.
  • Binary fields in JSON and XML. Neither format can hold raw bytes, so image blobs and signatures travel as Base64 strings.
  • PEM certificates and keys. The text between the BEGIN and END markers is Base64 encoded DER.
  • HTTP Basic Authentication. The username and password pair is Base64 encoded, which is exactly why the scheme requires HTTPS.

Base64 Is Encoding, Not Encryption

Base64 provides zero confidentialityAnyone who sees a Base64 string can decode it in one second with no key, no password, and no special tooling. It is a reversible public transformation, the same as writing a number in hexadecimal. Never use it to hide passwords, API keys, tokens, or personal data. If the content must stay secret, encrypt it with a real algorithm and a real key, then Base64 the ciphertext if you also need safe transport.

The related confusion is with hashing. A hash such as SHA-256 is one way and cannot be reversed, while Base64 is fully reversible by design. Choosing the wrong one is one of the most common security mistakes in application code.

The Base64 Alphabet

Every 6 bit group produces a value between 0 and 63, and that value is looked up in the table below. RFC 4648 fixes this ordering: uppercase letters first, then lowercase, then digits, then the plus and slash characters. The padding character (=) is not part of the alphabet, it only marks the end of an incomplete group.

IndexChar
0A
1B
2C
3D
4E
5F
6G
7H
8I
9J
10K
11L
12M
13N
14O
15P
IndexChar
16Q
17R
18S
19T
20U
21V
22W
23X
24Y
25Z
26a
27b
28c
29d
30e
31f
IndexChar
32g
33h
34i
35j
36k
37l
38m
39n
40o
41p
42q
43r
44s
45t
46u
47v
IndexChar
48w
49x
50y
51z
520
531
542
553
564
575
586
597
608
619
62+
63/

Working on something related? Browse every free developer tool on the site, including a Base64 decoder, JSON to Base64, URL encoder, and hash generators. Everything runs entirely in your browser, so nothing you paste is ever uploaded.

Standards and references

Frequently asked questions

How do I encode text to Base64?

Type or paste text in Encode mode and copy the output.

Does Base64 support Unicode?

Yes. Unicode text is converted to UTF-8 bytes before Base64 encoding.

Why does Base64 use = padding?

Padding completes the final four-character output group when input bytes are not a multiple of three.

Is Base64 encryption?

No. Anyone with the encoded text can decode it without a key.

Is the input uploaded?

No. Input is processed in this browser tab and is not uploaded by the tool. Copy and download are actions you control; ordinary page analytics do not receive tool input.