WebToolBox

Base64 Encode

Try the free Base64 Encode tool in the Encoding category provided by WebToolBox right in your browser. Process your tasks quickly and securely without any installation.

Input

Output

What is Base64 Encoding and How Does It Work?

Base64 is a standard binary-to-text encoding scheme (RFC 4648) that represents binary data using a set of 64 printable ASCII characters: uppercase letters (A-Z), lowercase letters (a-z), digits (0-9), plus (+), and forward slash (/).

It is primarily used to transmit arbitrary data across communication protocols that are strictly designed for text, such as email via MIME, HTML/CSS inline images (Data URIs), HTTP Basic Authentication headers, and JSON Web Tokens (JWT).

The underlying algorithm takes 3 bytes (24 bits) of binary input and splits them into four 6-bit chunks. Each 6-bit chunk maps directly to one of the 64 characters in the Base64 alphabet. When the input length is not a multiple of 3, padding characters (=) are appended to complete the 4-character block.

입출력 예시 (Examples)

입력 (Input)결과 (Output)설명
ManTWFuExactly 3 bytes (no padding required)
MaTWE=2 bytes (one '=' padding character added)
MTQ==1 byte (two '==' padding characters added)
Hello WorldSGVsbG8gV29ybGQ=Standard English sentence encoding

Binary & Text Data Encoding Formats Comparison

EncodingCharacter SetSize OverheadURL SafetyCommon Applications
Standard Base6464 chars (A-Z, a-z, 0-9, +, /) + =+33%Unsafe (+, / need escaping)Email attachments (MIME), Data URIs, HTTP Auth
URL-Safe Base6464 chars (A-Z, a-z, 0-9, -, _) (no padding)+33%Completely SafeJWTs, web cookies, URL parameters, tokens
Hexadecimal (Base16)16 chars (0-9, a-f)+100%Completely SafeCryptographic hashes (MD5, SHA-256), memory dumps
URL Percent EncodingASCII + %XX escapedVariable (up to +300%)Native URL StandardHTTP query strings, URI path parameters

How to Use the Online Base64 Encoder

  1. Enter or paste your text string into the input box above.
  2. The Base64 encoded result is generated immediately in real time.
  3. Click the 'Copy' button to copy the encoded string to your clipboard.
  4. If you need to decode, seamlessly switch to the 'Base64 Decode' tool in the navigation.

Developer Best Practices & Implementation Tips

  • Base64 is NOT Encryption: Anyone can instantly decode Base64 back to original text without a secret key. Never use Base64 alone to protect passwords or confidential user data.
  • Mind the 33% Bandwidth Overhead: Inlining large images (over 10KB-20KB) as Base64 data URIs into HTML increases file size and prevents parallel browser image caching.
  • Handling Multilingual UTF-8 Characters: The standard browser `btoa()` method fails on characters outside Latin1. This tool properly encodes strings into UTF-8 byte streams before encoding.

프로그래밍 언어별 사용 예제 (Code Examples)

JavaScript / Node.js (with UTF-8 support)javascript
// Browser modern JavaScript
function toBase64(str) {
  const bytes = new TextEncoder().encode(str);
  const binString = Array.from(bytes, (byte) => String.fromCharCode(byte)).join("");
  return btoa(binString);
}
console.log(toBase64('Hello World')); // SGVsbG8gV29ybGQ=

// Node.js
Buffer.from('Hello World', 'utf-8').toString('base64');
Python 3python
import base64

text = "Hello World"
encoded = base64.b64encode(text.encode('utf-8')).decode('ascii')
print(encoded) # SGVsbG8gV29ybGQ=

FAQ (자주 묻는 질문)

Why does Base64 increase data size by 33%?
Standard computer bytes store 8 bits of information. Base64 uses only 6 bits per character (2^6 = 64 characters) to ensure compatibility with plain ASCII systems. Representing 24 bits of data requires 4 Base64 characters instead of 3 raw bytes (4 / 3 = 1.333), creating a 33% size overhead.
What does the '=' symbol mean at the end of a Base64 string?
The '=' symbol is a padding character. If the input data is not an exact multiple of 3 bytes, 1 or 2 padding characters are added at the end to ensure the total string length is an exact multiple of 4.
Why does JavaScript window.btoa() throw an error on Unicode?
The legacy `btoa()` function only supports binary strings where each character code is 255 or below. Characters in languages like Korean, Japanese, Chinese, or emojis exceed this range. Our tool resolves this by converting the string to UTF-8 byte arrays first.
What is URL-Safe Base64?
Standard Base64 contains '+' and '/' characters, which have special meanings in URL query parameters. URL-Safe Base64 replaces '+' with '-' and '/' with '_', and frequently omits padding '=' symbols.
Is my data stored or sent to a remote server?
No. The encoding algorithm runs 100% locally on your machine via JavaScript in your browser. No data is transmitted across the internet.

Encoding — Tool Navigation