Base64 Encode / Decode

Use the tools below to Base64-encode or decode text, images, and files. To ensure data safety, the encoding and decoding are performed within the browser without being sent across the internet.

AdSense Space (In-article fluid)

Base64 Encode / Decode an Image or File

Use the tool below to Base64-encode or decode images and files. For text output, the result will be shown in the text area with options to copy or download. For image and binary output, the generated file will be downloaded directly. For large files, the encoding and decoding may take some time.

Base64 encoding and decoding is a method used to convert binary data to and from text format. Some computer systems—especially legacy systems—and certain transmission or storage formats are designed to handle text more reliably than raw binary data. Base64 encoding allows binary information, such as images, files, or other data, to be represented using a set of 64 printable ASCII characters, making it suitable for use in these systems and environments.

The Base64 character set includes uppercase letters A–Z, lowercase letters a–z, digits 0–9, and two additional characters, usually + and /. The symbol = is sometimes used as padding at the end of the encoded output to ensure that the encoded string has the proper length. The following table shows the Base64 characters and their corresponding numeric values based on RFC 4648.

0: A8: I16: Q24: Y32: g40: o48: w56: 4
1: B9: J17: R25: Z33: h41: p49: x57: 5
2: C10: K18: S26: a34: i42: q50: y58: 6
3: D11: L19: T27: b35: j43: r51: z59: 7
4: E12: M20: U28: c36: k44: s52: 060: 8
5: F13: N21: V29: d37: l45: t53: 161: 9
6: G14: O22: W30: e38: m46: u54: 262: +
7: H15: P23: X31: f39: n47: v55: 363: /

Modern computers are byte-based (8 bits per byte), while Base64 encoding represents data using 6-bit values mapped to 64 characters. As a result, Base64-encoded data is typically about 4/3 (≈1.33) times the size of the original data.

As an example, the simple text 'Dog' can be encoded in Base64 as 'RG9n'. The three ASCII characters in 'Dog' have a total of 3 × 8 = 24 bits, which divides evenly into four 6-bit blocks (17, 6, 61, 39 → R, G, 9, n). When there are 2 or 4 bits remaining at the end, one or two '=' padding characters are added: 'Do' encodes as 'RG8=', and 'Dogs' encodes as 'RG9ncw=='.

Base64 encoding and decoding are widely used in data transmission, web development, and file processing. Two examples of many uses:

E-mail attachments: Originally, SMTP was designed to transport only 7-bit ASCII characters. Encoding binary data using Base64 allows older SMTP servers to correctly transmit attachments.

Embedding binary data in text files: Text-based formats are widely used in computer systems, especially for transmitting data over the internet. Base64 enables the embedding of binary data in these text files. For example, binary data can be Base64-encoded and included in JSON or XML files. Images or PDF files can also be Base64-encoded and embedded in HTML or CSS.

Frequently Asked Questions

Does this tool send my data across the Internet?
No. The encoding and decoding are performed within the browser without being sent across the internet, so your text and files stay on your device.
Why does the character set matter when decoding?
Base64 only stores bytes. To turn those bytes back into text, the tool needs to know which encoding the bytes represent, such as UTF-8, UTF-16, or Windows-1256 for Arabic text.

Related Calculators