Skip to main content

Base64 Encoder Decoder Calculator

Free Base64 encoder decoder Calculator for web & development. Enter parameters to get optimized results with detailed breakdowns.

Skip to calculator
Computer & IT

Base64 Encoder Decoder

Encode text to Base64 and decode Base64 strings back to text. See encoding statistics, overhead analysis, and step-by-step binary conversion.

Last updated: December 2025

Calculator

Adjust values & calculate
Encoded Output

SGVsbG8sIFdvcmxkIQ==

Encoding Statistics
53.8% overhead
13 chars input, 20 chars output
Size Ratio
1.54x
Padding (=)
2
Input Bytes
13
Character to Binary Mapping
H (ASCII 72)01001000
e (ASCII 101)01100101
l (ASCII 108)01101100
l (ASCII 108)01101100
o (ASCII 111)01101111
, (ASCII 44)00101100
Note: Base64 is an encoding scheme, not encryption. It provides no security or confidentiality. Anyone can decode Base64 data without a key. For data security, use proper encryption algorithms.
Your Result
Encoded: SGVsbG8sIFdvcmxkIQ== (20 chars, 53.8% overhead)
Share Your Result
Understand the Math

Formula

Every 3 input bytes become 4 Base64 characters (6 bits each)

Base64 divides input bytes into 6-bit groups and maps each group to one of 64 printable ASCII characters. Input is padded to a multiple of 3 bytes, and output is padded with = signs to a multiple of 4 characters.

Last reviewed: December 2025

Worked Examples

Example 1: Encoding a Simple String

Encode 'Hello, World!' to Base64.
Solution:
Convert each character to ASCII: H=72, e=101, l=108, l=108, o=111, ,=44, (space)=32, W=87, o=111, r=114, l=108, d=100, !=33 Group into 3-byte blocks and convert to 4 Base64 characters: Hel -> SGVs lo, -> bG8s Wo -> IFdv rld -> cmxk ! -> IQ== Result: SGVsbG8sIFdvcmxkIQ==
Result: SGVsbG8sIFdvcmxkIQ== (18 chars from 13 input chars, 38% overhead)

Example 2: Decoding a Base64 JWT Payload

Decode the Base64 string 'eyJuYW1lIjoiSm9obiJ9' (a JWT payload).
Solution:
Base64 decode character by character: e=30, y=50, J=9, u=46, Y=24, W=22, 1=53, l=37... Group into 6-bit values, reconstruct bytes: Result bytes: 123 34 110 97 109 101 34 58 34 74 111 104 110 34 125 ASCII interpretation: {"name":"John"}
Result: eyJuYW1lIjoiSm9obiJ9 decodes to {"name":"John"}
Expert Insights

Background & Theory

The Base64 Encoder Decoder applies the following established principles and formulas. Computers represent all information using binary, a base-2 number system consisting solely of the digits 0 and 1, each called a bit. Because long binary strings are unwieldy, programmers routinely use octal (base 8) and hexadecimal (base 16) as compact shorthand. Converting between bases follows a consistent algorithm: divide the source number repeatedly by the target base, collecting remainders in reverse order. Hexadecimal digits A through F represent the values 10 through 15, allowing a single character to encode four binary bits, making it the preferred notation for memory addresses, color codes, and bytecode. Bitwise operations manipulate individual bits within integers. AND produces a 1 only when both input bits are 1, making it useful for masking. OR produces a 1 when either bit is 1 and is used for combining flags. XOR flips bits that differ, enabling simple toggle logic and efficient swap algorithms. NOT inverts every bit (one's complement), while left and right shifts multiply or divide by powers of two in constant time. Data storage units ascend in binary multiples of 1024: 8 bits form one byte, 1024 bytes form one kibibyte (KiB), 1024 KiB form one mebibyte (MiB), and so forth. Hard-drive manufacturers historically use decimal prefixes (1 KB = 1000 bytes), creating the persistent confusion between binary and decimal interpretations of the same label. The IEC standardized the binary prefixes KiB, MiB, GiB, and TiB in 1998 to resolve this ambiguity. Network bandwidth is measured in bits per second (bps), most commonly megabits per second (Mbps) or gigabits per second (Gbps). A 100 Mbps connection transfers 100 million bits every second, equating to roughly 12.5 megabytes per second. IP subnet masks define network boundaries; CIDR notation appends a prefix length (e.g., /24) to an address, indicating how many leading bits are fixed. A /24 subnet contains 256 addresses with 254 usable hosts. Algorithm efficiency is described using Big-O notation, which characterises the worst-case growth of time or space relative to input size. O(1) is constant, O(log n) is logarithmic (binary search), O(n) is linear, and O(nยฒ) is quadratic. Cryptographic hash functions like SHA-256 produce a fixed 256-bit (32-byte) digest regardless of input length. File compression algorithms exploit statistical redundancy to reduce storage footprint, and compression ratio equals the original file size divided by the compressed size.

History

The history behind the Base64 Encoder Decoder traces back through the following developments. The conceptual foundation of modern computing traces back to Charles Babbage, whose Analytical Engine design of 1837 introduced the idea of a general-purpose mechanical computer with separate storage and processing units, including what he called the Store and the Mill. Ada Lovelace wrote what many consider the first algorithm intended for machine execution while annotating a translation of Luigi Menabrea's account of Babbage's work, also recognising the machine's potential to manipulate symbols beyond mere numbers. George Boole published "The Laws of Thought" in 1854, formalising a two-valued algebra of logic that would later map perfectly to electrical circuits. It remained largely a mathematical curiosity until Claude Shannon's landmark 1937 master's thesis demonstrated that Boolean algebra could describe switching circuits, laying the theoretical groundwork for all digital electronics. Shannon's 1948 paper "A Mathematical Theory of Communication" defined the bit as the fundamental unit of information and established information theory as a rigorous discipline. The same year, the transistor was invented at Bell Labs by Bardeen, Brattain, and Shockley, eventually replacing vacuum tubes and enabling miniaturisation at scale. ENIAC, completed in 1945, was one of the first general-purpose electronic computers, occupying 1800 square feet and consuming 150 kilowatts of power while performing roughly 5000 additions per second. The ASCII standard was ratified in 1963, assigning 7-bit codes to 128 characters and enabling interoperability between computers from different manufacturers. Through the 1970s, the microprocessor consolidated an entire CPU onto a single chip; Intel's 4004 in 1971 marked the beginning of this trend. The Apple II launched in 1977 and the IBM PC in 1981 brought computing to homes and offices, triggering a mass-market software industry. Tim Berners-Lee proposed the World Wide Web in 1989 and launched the first website in 1991 at CERN, transforming the internet from an academic and military network into a global information infrastructure. Mobile computing accelerated through the 2000s with smartphones integrating powerful processors, wireless networking, and GPS into pocket-sized devices, extending computation into every facet of daily life and cementing TCP/IP as the universal communications fabric.

Share this calculator

Explore More

Frequently Asked Questions

Base64 is a binary-to-text encoding scheme that represents binary data using 64 printable ASCII characters (A-Z, a-z, 0-9, +, and /). It is used whenever binary data needs to be transmitted through text-based channels that do not support raw binary. Common uses include embedding images in HTML/CSS using data URIs, encoding email attachments via MIME, transmitting binary data in JSON/XML, storing cryptographic keys and certificates in PEM format, and encoding authentication credentials in HTTP Basic Auth. Base64 ensures data integrity during transmission because all 64 characters are universally supported across different systems and protocols.
Base64 encoding works by converting groups of three bytes (24 bits) into four Base64 characters (6 bits each). First, the input text is converted to its binary representation using ASCII/UTF-8 values. Then the binary stream is divided into 6-bit groups. Each 6-bit group (values 0-63) is mapped to one of 64 characters: A-Z (0-25), a-z (26-51), 0-9 (52-61), + (62), and / (63). If the input length is not a multiple of three, padding characters (=) are added to make the output length a multiple of four. For example, encoding 'Hi' (two bytes) produces 'SGk=' with one padding character.
Base64 increases data size because it maps every 3 bytes of input to 4 bytes of output. The ratio is exactly 4/3, or approximately 33% overhead. This happens because each output character represents only 6 bits of data but occupies 8 bits (one byte) of storage. Three input bytes provide 24 bits of data, which requires exactly four 6-bit Base64 characters. Additionally, padding with equals signs can add 1-2 extra characters. For large data like images, this 33% increase can be significant. This is why Base64 is used for encoding, not compression. When transmitting large binary files, other methods like multipart/form-data are preferred over Base64 encoding.
No, Base64 is absolutely not encryption. Base64 is an encoding scheme that transforms data into a different representation without any security or secrecy. Anyone can decode Base64 data instantly without any key or password. It provides zero confidentiality. A common security mistake is Base64-encoding sensitive data like passwords and assuming they are protected. Base64 is as easy to reverse as converting uppercase to lowercase. For actual data protection, use proper encryption algorithms like AES-256 or RSA. Base64 encoding is often used alongside encryption, such as encoding encrypted binary output into text for transmission, but the Base64 step adds no security whatsoever.
Data URIs allow embedding small files directly into HTML, CSS, or JavaScript using Base64 encoding. The format is data:[mediatype][;base64],data. For example, a small PNG image can be embedded as an img src attribute with the value data:image/png;base64, followed by the Base64-encoded image data. This eliminates an HTTP request, which can improve page load performance for small assets. CSS commonly uses data URIs for small icons and background images. However, Base64 data URIs increase the file size by 33% and cannot be cached independently, so they are best for files under 5-10 KB. Larger files should use traditional URL references for better performance.
These encodings differ in how many characters they use and their efficiency. Base64 uses 64 characters (6 bits per character), producing 4 output characters per 3 input bytes (33% overhead). Base32 uses 32 characters (5 bits per character), producing 8 output characters per 5 input bytes (60% overhead). It uses only uppercase letters and digits 2-7, making it case-insensitive and avoiding confusing characters. Base16 (hexadecimal) uses 16 characters (4 bits per character), producing 2 output characters per input byte (100% overhead). Base64 is most efficient for data encoding. Base32 is used in TOTP tokens and DNS names. Base16 is used for simple hex representations.
Educational Note: This calculator is provided for educational and informational purposes. Results are based on the formulas and inputs provided. Always verify important calculations independently. NovaCalculator processes calculator inputs client-side; optional analytics follow visitor consent settings. ยฉ 2024โ€“2026 NovaCalculator.

Share this calculator

Formula

Every 3 input bytes become 4 Base64 characters (6 bits each)

Base64 divides input bytes into 6-bit groups and maps each group to one of 64 printable ASCII characters. Input is padded to a multiple of 3 bytes, and output is padded with = signs to a multiple of 4 characters.

Worked Examples

Example 1: Encoding a Simple String

Problem: Encode 'Hello, World!' to Base64.

Solution: Convert each character to ASCII:\nH=72, e=101, l=108, l=108, o=111, ,=44, (space)=32, W=87, o=111, r=114, l=108, d=100, !=33\n\nGroup into 3-byte blocks and convert to 4 Base64 characters:\nHel -> SGVs\nlo, -> bG8s\n Wo -> IFdv\nrld -> cmxk\n! -> IQ==\n\nResult: SGVsbG8sIFdvcmxkIQ==

Result: SGVsbG8sIFdvcmxkIQ== (18 chars from 13 input chars, 38% overhead)

Example 2: Decoding a Base64 JWT Payload

Problem: Decode the Base64 string 'eyJuYW1lIjoiSm9obiJ9' (a JWT payload).

Solution: Base64 decode character by character:\ne=30, y=50, J=9, u=46, Y=24, W=22, 1=53, l=37...\n\nGroup into 6-bit values, reconstruct bytes:\nResult bytes: 123 34 110 97 109 101 34 58 34 74 111 104 110 34 125\n\nASCII interpretation: {\"name\":\"John\"}

Result: eyJuYW1lIjoiSm9obiJ9 decodes to {\"name\":\"John\"}

Frequently Asked Questions

What is Base64 encoding and what is it used for?

Base64 is a binary-to-text encoding scheme that represents binary data using 64 printable ASCII characters (A-Z, a-z, 0-9, +, and /). It is used whenever binary data needs to be transmitted through text-based channels that do not support raw binary. Common uses include embedding images in HTML/CSS using data URIs, encoding email attachments via MIME, transmitting binary data in JSON/XML, storing cryptographic keys and certificates in PEM format, and encoding authentication credentials in HTTP Basic Auth. Base64 ensures data integrity during transmission because all 64 characters are universally supported across different systems and protocols.

How does Base64 encoding work step by step?

Base64 encoding works by converting groups of three bytes (24 bits) into four Base64 characters (6 bits each). First, the input text is converted to its binary representation using ASCII/UTF-8 values. Then the binary stream is divided into 6-bit groups. Each 6-bit group (values 0-63) is mapped to one of 64 characters: A-Z (0-25), a-z (26-51), 0-9 (52-61), + (62), and / (63). If the input length is not a multiple of three, padding characters (=) are added to make the output length a multiple of four. For example, encoding 'Hi' (two bytes) produces 'SGk=' with one padding character.

Why does Base64 increase the data size by approximately 33 percent?

Base64 increases data size because it maps every 3 bytes of input to 4 bytes of output. The ratio is exactly 4/3, or approximately 33% overhead. This happens because each output character represents only 6 bits of data but occupies 8 bits (one byte) of storage. Three input bytes provide 24 bits of data, which requires exactly four 6-bit Base64 characters. Additionally, padding with equals signs can add 1-2 extra characters. For large data like images, this 33% increase can be significant. This is why Base64 is used for encoding, not compression. When transmitting large binary files, other methods like multipart/form-data are preferred over Base64 encoding.

Is Base64 encoding the same as encryption?

No, Base64 is absolutely not encryption. Base64 is an encoding scheme that transforms data into a different representation without any security or secrecy. Anyone can decode Base64 data instantly without any key or password. It provides zero confidentiality. A common security mistake is Base64-encoding sensitive data like passwords and assuming they are protected. Base64 is as easy to reverse as converting uppercase to lowercase. For actual data protection, use proper encryption algorithms like AES-256 or RSA. Base64 encoding is often used alongside encryption, such as encoding encrypted binary output into text for transmission, but the Base64 step adds no security whatsoever.

How is Base64 used in web development with data URIs?

Data URIs allow embedding small files directly into HTML, CSS, or JavaScript using Base64 encoding. The format is data:[mediatype][;base64],data. For example, a small PNG image can be embedded as an img src attribute with the value data:image/png;base64, followed by the Base64-encoded image data. This eliminates an HTTP request, which can improve page load performance for small assets. CSS commonly uses data URIs for small icons and background images. However, Base64 data URIs increase the file size by 33% and cannot be cached independently, so they are best for files under 5-10 KB. Larger files should use traditional URL references for better performance.

What is the difference between Base64, Base32, and Base16 encoding?

These encodings differ in how many characters they use and their efficiency. Base64 uses 64 characters (6 bits per character), producing 4 output characters per 3 input bytes (33% overhead). Base32 uses 32 characters (5 bits per character), producing 8 output characters per 5 input bytes (60% overhead). It uses only uppercase letters and digits 2-7, making it case-insensitive and avoiding confusing characters. Base16 (hexadecimal) uses 16 characters (4 bits per character), producing 2 output characters per input byte (100% overhead). Base64 is most efficient for data encoding. Base32 is used in TOTP tokens and DNS names. Base16 is used for simple hex representations.

References

Reviewed by Daniel Agrici, Founder & Lead Developer ยท Editorial policy