Calculators PlanetCalculators Planet
HomeFinancialMathHealthOtherBlogAboutContact
Calculators PlanetCalculators Planet

Fast, accurate, and user-friendly online calculators for all your needs.

Financial

  • Mortgage Calculator
  • Amortization Calculator
  • Mortgage Payoff Calculator
  • House Affordability Calculator
  • Rent Calculator

Math

  • Decimal to Fraction Calculator
  • Significant Figures Calculator
  • Percentage Calculator
  • Fraction Calculator
  • Ratio Calculator

Health

  • BMI Calculator
  • Ideal Weight Calculator
  • Body Fat Calculator
  • Calorie Calculator
  • Macro Calculator

Other

  • Age Calculator
  • Date Calculator
  • Time Calculator
  • Hours Calculator
  • Time Card Calculator

2026 Calculators Planet. All rights reserved.

BlogAboutContactPrivacy PolicyCookie PolicyTerms of ServiceDisclaimer
Calculators PlanetCalculators Planet
HomeFinancialMathHealthOtherBlogAboutContact
HomeOtherBase64 Encode / Decode

Base64 Encode / Decode

Convert plain text to Base64 and decode Base64 strings back to their original text. Supports Unicode characters including emojis and non-Latin scripts.

Share:
Text to Base64

0 characters

Base64 Output

What Is Base64?

You have a binary file that needs to travel through an email system designed for text. The email protocol was built in the 1980s and only handles ASCII characters. Send raw binary data through it and the bytes get corrupted. Base64 solves this problem by converting binary data into a string of printable ASCII characters that any text-based system can handle safely.

Base64 was formalized in the MIME (Multipurpose Internet Mail Extensions) standard in 1992, which extended email to support attachments, images, and non-text content. The encoding is defined in RFC 4648, published by the Internet Engineering Task Force (IETF). Today, Base64 is used far beyond email. It appears in JSON Web Tokens (JWTs), data URIs in HTML and CSS, HTTP Basic Authentication headers, and API payloads across the web.

Base64 is not encryption. It does not provide confidentiality or security. Anyone can decode a Base64 string instantly. Its purpose is purely to make binary data safe for text-based transmission. If you need to securely protect data, use encryption algorithms like AES instead.

What This Tool Does

This tool encodes plain text to Base64 and decodes Base64 strings back to plain text. It handles the full Unicode character range by using UTF-8 encoding internally before applying Base64, ensuring that non-ASCII characters (accents, emoji, non-Latin scripts) are handled correctly.

  • Encode inputs: Any plain text string, including Unicode characters
  • Encode outputs: A Base64 string using the standard alphabet (A-Z, a-z, 0-9, +, /) with = padding
  • Decode inputs: A valid Base64 string
  • Decode outputs: The original plain text

How the Encoding Works

Base64 works by grouping binary data into 6-bit chunks and mapping each chunk to one of 64 printable characters. The character set is: A-Z (0-25), a-z (26-51), 0-9 (52-61), + (62), / (63). If the input is not a multiple of 3 bytes, = padding is added to complete the final group. This is specified in RFC 4648, which also defines Base32 and Base16 (hex) encoding schemes.

Every 3 bytes of input = 4 Base64 characters

Output size = ceil(input bytes / 3) x 4 characters

This means Base64 always increases data size by approximately 33%. For example, a 3-byte (24-bit) input becomes 4 characters (32 bits). A 1 MB binary file encodes to approximately 1.33 MB of Base64 text. This trade-off is accepted because the encoded output is universally compatible with text-only systems.

How to Use the Tool

  1. Select the Encode tab to convert plain text to Base64
  2. Paste or type your text in the input area
  3. Click Encode to see the Base64 output
  4. Use the Copy button to copy the result to your clipboard
  5. Switch to the Decode tab to convert a Base64 string back to plain text
  6. Paste the Base64 string and click Decode

Example Encodings

Example 1: Simple Text

The text "Hello" encodes to "SGVsbG8=". Breaking it down: H=72, e=101, l=108, l=108, o=111. These 5 bytes become the groups 010010 000110 010101 101100 011010 110110 111000 (padded), mapping to S, G, V, s, b, G, 8, = in the Base64 alphabet. The = at the end signals that one byte of padding was added.

Example 2: JSON Data in a JWT

The JSON string {"user":"admin","role":"superuser"} encodes to "eyJ1c2VyIjoiYWRtaW4iLCJyb2xlIjoic3VwZXJ1c2VyIn0=". This is the format used in JWT (JSON Web Token) payloads, where the header and body are Base64url-encoded JSON objects. A JWT consists of three Base64url sections separated by dots. Pasting the middle section (the payload) into the decode tab reveals the token's claims without needing a dedicated JWT debugger. For URL-specific encoding, use our URL Encode / Decode tool, which handles percent-encoding for web addresses.

Real-World Scenarios

Embedding Images in HTML or CSS

Sarah, a front-end developer in Toronto, needs to embed a 2 KB logo directly in a CSS file to eliminate an additional HTTP request. She encodes the PNG file as a Base64 data URI: background-image: url("data:image/png;base64,iVBORw0K..."). The browser renders the image without fetching a separate file. This technique is common for small icons and sprites but becomes inefficient for large images due to the 33% size overhead. Sarah keeps the file under 4 KB after encoding to avoid bloating her stylesheet. For generating secure credentials to pair with embedded assets, our Password Generator creates strong random passwords for API keys and service accounts.

Debugging an API Authentication Header

Marcus, a backend developer in Berlin, is debugging a 401 error from a REST API. The API uses HTTP Basic Authentication, which encodes the username and password as Base64 in the Authorization header: Authorization: Basic dXNlcjpwYXNzd29yZA==. He pastes "dXNlcjpwYXNzd29yZA==" into the decode tab and sees "user:password". He realizes the API expects the username in a different format. Without this tool, he would have needed to write a script or open a terminal to decode the header.

Inspecting a JWT Token

Priya, a security analyst in Mumbai, receives a JWT from a client application and needs to verify its claims. She splits the token at the dots and pastes the middle section into the decode tab. The output reveals: {"sub":"1234567890","name":"Priya Patel","iat":1516239022}. She can see the subject, name, and issued-at timestamp without installing a JWT library. She notices the token has no expiration claim, which is a security concern she reports to the development team.

Why This Tool Matters

Base64 encoding is a daily tool for web developers, API integrators, and security analysts. Being able to quickly encode and decode strings without writing code speeds up debugging, API testing, and content inspection tasks. The encoding is defined in RFC 4648 and is supported by virtually every programming language, making it a universal format for binary-to-text conversion.

Common Mistakes to Avoid

  • Confusing Base64 with encryption: Base64 provides zero security. Never treat a Base64-encoded string as hidden or protected information. It is trivially reversible by anyone with a decoder
  • Removing padding characters: The = padding at the end of a Base64 string is required for correct decoding. Removing it may cause errors depending on the decoder. Some URL-safe variants omit padding, but standard decoders expect it
  • Using Base64url vs standard Base64: JWTs and URL-safe encoding use a variant that replaces + with - and / with _, and typically omits padding. Standard decoders may fail on these variants. Always check which variant your application expects
  • Encoding already-encoded data: Encoding a Base64 string again produces a valid but double-encoded result. Always decode from the original Base64 rather than encoding an already-encoded value. Double encoding inflates the size by another 33%

Limitations of This Tool

This tool accepts text input only. To encode a binary file (such as an image or PDF), you would need to read its raw bytes first, which requires a code-based approach or a dedicated file encoding tool. The tool uses the standard Base64 alphabet defined in RFC 4648. It does not automatically handle Base64url variants (which use - and _ instead of + and /). If you are decoding a JWT payload, you may need to replace - with + and _ with / and add = padding manually before decoding. For hexadecimal number conversions, our Hex Calculator handles base-16 arithmetic and conversions.

Authoritative Research & Resources

  • IETF RFC 4648: The Base16, Base32, and Base64 Data Encodings - The official Internet Engineering Task Force standard that defines Base64 encoding, including the character set, padding rules, and URL-safe variants
  • IETF RFC 2045: MIME Part One - The original MIME specification that introduced Base64 for email attachments, extending internet email to support non-text content
  • IETF RFC 7519: JSON Web Token (JWT) - Defines how JWTs use Base64url encoding for the header and payload sections, relevant to modern web authentication

Frequently Asked Questions

Is Base64 the same as encryption?
No. Base64 is an encoding scheme, not encryption. It converts binary data to printable text using a fixed, publicly known algorithm defined in RFC 4648. Anyone with any Base64 decoder can instantly reverse it. Never use Base64 to hide sensitive data. For actual security, use encryption algorithms like AES.
Why does Base64 output end with = or == signs?
Base64 works on groups of 3 bytes at a time. If the input length is not a multiple of 3, one or two = characters are added as padding to complete the final 4-character group. A single = means one byte of padding was added; == means two bytes were added. This padding ensures decoders can correctly identify where data ends. RFC 4648 specifies this padding requirement.
What is Base64url and how is it different?
Base64url is a URL-safe variant of Base64 defined in RFC 4648. It is used in JWTs and other web contexts. It replaces the + character with - and the / character with _, and typically omits the = padding. These substitutions prevent conflicts with URL-reserved characters. Standard Base64 decoders may not handle Base64url input without manual conversion.
Can Base64 encode any type of file?
Yes. Base64 can encode any binary data, including images, PDFs, zip files, and executables. However, this tool accepts text input only. To encode a file, you would need to read its raw bytes first, which requires a code-based approach or a dedicated file encoding tool. The encoded output will be approximately 33% larger than the original file.
Why does Base64-encoded text take up more space?
Base64 represents every 3 bytes of input as 4 ASCII characters. This means encoded data is approximately 33% larger than the original. For small strings this overhead is negligible, but for large files it is significant. A 10 MB file becomes about 13.3 MB when Base64-encoded. This trade-off is accepted because the encoded output is universally compatible with text-only systems.
Where did Base64 come from?
Base64 originated in the MIME (Multipurpose Internet Mail Extensions) standard, formalized in 1992 through RFC 2045. MIME extended internet email, which was originally text-only, to support attachments, images, and other binary content. The encoding was later formalized as a standalone specification in RFC 4648 by the IETF. Today it is used in JWTs, data URIs, HTTP authentication, and countless API protocols.

Related Calculators

URL Encode / Decode

Encode and decode URL strings for safe use in web addresses

Password Generator

Generate strong, random passwords with custom length and character sets

Hex Calculator

Perform arithmetic and conversions with hexadecimal numbers

Bandwidth Calculator

Calculate file transfer times and required bandwidth

Big Number Calculator

Perform exact arithmetic on large integers

Embed This Calculator

Base64 Encode / Decode

Calculate
Reset
Calculators PlanetCalculators Planet

Fast, accurate, and user-friendly online calculators for all your needs.

Financial

  • Mortgage Calculator
  • Amortization Calculator
  • Mortgage Payoff Calculator
  • House Affordability Calculator
  • Rent Calculator

Math

  • Decimal to Fraction Calculator
  • Significant Figures Calculator
  • Percentage Calculator
  • Fraction Calculator
  • Ratio Calculator

Health

  • BMI Calculator
  • Ideal Weight Calculator
  • Body Fat Calculator
  • Calorie Calculator
  • Macro Calculator

Other

  • Age Calculator
  • Date Calculator
  • Time Calculator
  • Hours Calculator
  • Time Card Calculator

2026 Calculators Planet. All rights reserved.

BlogAboutContactPrivacy PolicyCookie PolicyTerms of ServiceDisclaimer