Base64 Encoder
Encode plain text or UTF-8 string data into Base64 format with support for URL-safe encoding.
Base64 Text Encoder
Type text below to generate Base64 output instantly.
What is Base64 Encoding?
Base64 is a binary-to-text encoding algorithm designed to represent binary data using only a set of 64 readable ASCII characters. It was developed to allow binary data—such as image files, cryptographic signatures, and encrypted payloads—to be transmitted safely across legacy text-only channels like email (SMTP) and HTTP headers without data loss or character corruption.
Our online Base64 encoder encodes standard text, code snippets, and multi-byte UTF-8 characters (including foreign alphabets, accented characters, and emojis) directly into Base64 format. It also includes an optional URL-Safe Base64 mode that swaps + with -, / with _, and removes trailing padding, adhering to RFC 4648 Section 5 for safe inclusion in URLs and query strings.
How to Encode Text into Base64
- Enter Text: Type or paste your plain text, string, or code into the input textarea above.
- Select Encoding Options (Optional): Check the URL-Safe Base64 option if you plan to use the generated output in URL query parameters, JSON Web Tokens (JWT), or web APIs.
- Click Encode to Base64: Press Encode to Base64 to transform the input into a standard Base64 string.
- Copy or Download: Use Copy Output to copy the result to your clipboard, or click Download TXT to save the encoded file.
Practical Base64 Encoding Examples
The table below demonstrates how common text strings convert into standard Base64 and URL-safe Base64:
| Input Text | Standard Base64 Output | URL-Safe Base64 Output | Notes |
|---|---|---|---|
Hello World! |
SGVsbG8gV29ybGQh |
SGVsbG8gV29ybGQh |
Divides cleanly into 3-byte blocks; no padding needed |
Hello |
SGVsbG8= |
SGVsbG8 |
Standard includes = padding; URL-safe strips padding |
test |
dGVzdA== |
dGVzdA |
Two padding bytes in standard Base64 |
🚀 café |
8J+agCBjYWbDqQ== |
8J-agCBjYWbDqQ |
URL-safe replaces + with - and drops padding |
Common Real-World Uses for Base64 Encoding
- HTTP Basic Authentication: Web servers frequently authenticate requests using HTTP Basic Auth, which requires combining
username:passwordinto a Base64-encoded string passed in theAuthorizationheader. - Inline Data URIs: Web developers encode small icons, SVG graphics, and font files into Base64 data URIs (e.g.,
src="data:image/svg+xml;base64,...") to eliminate extra HTTP requests and improve initial page render speed. - Safe Data Transfer in APIs: Transferring binary certificates, encryption keys, or hashes via REST APIs and JSON objects requires Base64 encoding because JSON format only accepts text strings.
- Email Protocol Compatibility (MIME): Email systems adhering to MIME specifications encode binary attachments (PDFs, images) as Base64 strings to guarantee error-free delivery across disparate mail servers.
- Web Safe Tokens: URL-Safe Base64 (Base64URL) is standard in JSON Web Tokens (JWT) and OAuth state parameters because it avoids reserved URL characters like
+and/.
How Does the Base64 Algorithm Work?
Base64 works by taking three 8-bit bytes of text (24 bits in total) and splitting them into four 6-bit chunks. Each 6-bit chunk represents a numerical value between 0 and 63, which maps directly to one of the 64 characters in the Base64 index. To understand how text characters convert into base-2 bits, read our text to binary translation guide:
- Binary Split: Three ASCII characters (e.g.,
"Man"= 77, 97, 110) are expressed in binary:01001101 01100001 01101110. - 6-Bit Grouping: The 24 bits are divided into four 6-bit numbers:
010011(19),010110(22),000101(5),101110(46). - Character Mapping: The values map to the Base64 table characters: 19 =
T, 22 =W, 5 =F, 46 =u→"TWFu".
Already have a Base64 encoded string you need to read? Convert it back to readable plain text with our Base64 Decoder. You can also explore our URL Decoder & Encoder, HTML Entity Encoder, or inspect raw byte structures with the Text to Binary Converter.
Frequently Asked Questions
What is Base64 encoding used for?
Base64 is used to encode binary data or complex character sets into standard ASCII characters. This ensures the data can travel through systems that only support text—such as email headers, URLs, XML documents, and JSON payloads—without corruption or character loss.
Is Base64 a form of encryption?
No. Base64 is an encoding format, not encryption. It provides zero confidentiality because anyone can instantly decode a Base64 string back to its original form without a password or key. Never rely on Base64 to secure sensitive data like passwords.
What is the difference between standard Base64 and URL-Safe Base64?
Standard Base64 uses + and /, which have reserved meanings in URL query strings and web addresses (where + represents a space). URL-Safe Base64 (RFC 4648 §5) replaces + with hyphen (-), / with underscore (_), and typically omits trailing padding (=) so strings can be safely placed in URLs without percent-encoding.
Why does Base64 output appear larger than the original text?
Base64 encoding increases data size by approximately 33%. Because 3 bytes (24 bits) are converted into 4 characters (32 bits), every 3 bytes of input produce 4 bytes of output.
Does this tool support Unicode and emojis?
Yes. The tool encodes text using UTF-8 byte serialization before converting to Base64. This means foreign languages, accents, mathematical notation, and emojis are completely supported.
Explore More Free Text & Conversion Tools
Fast, secure, and easy-to-use online text utilities built for creators and developers.
Text Case Converter
Convert text between UPPERCASE, lowercase, Title Case, Sentence case and Capitalized case.
Character Counter
Count total characters with and without spaces, words, sentences, and lines in real-time.
Word Counter Online
Accurately count words, unique vocabulary, characters, reading time, and word frequency.
Sentence Counter
Count sentences accurately, calculate average sentence length and readability metrics.
Reading Time Calculator
Estimate reading and speaking time based on custom WPM reading speeds.
Decimal to Hex Converter
Convert base-10 decimal numbers to hexadecimal format with prefix and padding controls.
Text Reverser
Reverse text characters, word order, line order, or flip text upside down instantly.
Letter Counter
Accurately count total letters (A-Z), vowels, consonants, and analyze letter frequencies.
Line Counter
Count total lines, non-empty lines, empty lines, and add line numbers automatically.
Text Cleaner
Clean duplicate spaces, strip HTML tags, remove empty lines, symbols, and numbers.
Alphabetical Order Sorter
Sort lines or words alphabetically (A-Z / Z-A), remove duplicates, or sort by length.
Line Break Remover
Remove newlines, replace breaks with custom delimiters, and preserve paragraphs.
Title Capitalization Tool
Convert text into proper title case following AP Style and Chicago style guidelines.
Text Formatter
Format line prefixes, suffixes, paragraph indentations, and sentence spacing.
Whitespace Remover
Remove all spaces, collapse multiple spaces, trim lines, and remove tab characters.
Word Frequency Counter
Analyze word frequency counts, filter stop words, and sort vocabulary density.
HTML Entity Encoder
Encode special HTML characters into Named, Decimal, or Hexadecimal HTML entities.
Base64 Encoder
Encode UTF-8 text or strings into standard or URL-safe Base64 format.
Base64 Decoder
Decode Base64 string data back to readable UTF-8 text with input error validation.
URL Decoder
Decode URL-encoded strings, percent encodings, and parse query parameters.
Text to Binary Converter
Convert plain text strings into 8-bit binary code (0s and 1s) with UTF-8 byte encoding.