Encoding & Data

πŸ“¦

Base64 Converter: Encode & Decode Base64 (UTF-8)

Encode text to Base64 and decode Base64 to text. UTF-8 support for emojis and special characters. See character count and byte size. Auto-detect Base64 input. Free, in-browser.

Base64 Converter

Encode text to Base64 or decode Base64 to text. UTF-8 encoding supports emojis and special characters. Pasting Base64 (e.g. ending in =) may auto-decode. Valid Base64 uses only letters, digits, +, /, and = padding; the length (after removing spaces) must be a multiple of 4.

Character count: 0 Β· Size: 0 B

Recent conversions

Last 5 unique conversions appear here. Stored in your browser.

Base64 Converter: Encode & Decode Base64 (UTF-8)

Encode text to Base64 and decode Base64 to text in one tool. Uses UTF-8 so emojis and special characters work correctly. Free, runs in your browser, and shows character count and byte-size impact (Base64 adds about 33% size). Use it for APIs, data URLs, email attachments, or any Base64 encoding and Base64 decoding need.

What is Base64 encoding?

Base64 is a way to represent binary data using only 64 printable ASCII characters: uppercase and lowercase letters (A–Z, a–z), digits (0–9), plus +, and slash /. A 65th character, =, is used for padding so the encoded string length is always a multiple of 4. That makes Base64 safe to embed in JSON, XML, URLs, and email bodies where raw binary bytes would break. When you encode to Base64, your text is first turned into bytes (we use UTF-8), then each group of 3 bytes becomes 4 Base64 characters. Decode Base64 reverses that: 4 characters become 3 bytes, then bytes are interpreted as UTF-8 text.

This converter does both directions. Paste plain text and click Encode to Base64 to get a Base64 string (e.g. SGVsbG8= for "Hello"). Paste a Base64 string and click Decode to Text to get the original text back. Valid Base64 must use only those characters and have a length (after removing spaces) that is a multiple of 4.

How to encode text to Base64 (step by step)

To convert text to Base64 manually: (1) Turn the text into bytes using UTF-8 (one byte per ASCII character, multiple bytes for emojis or accented letters). (2) Take bytes in groups of 3 (24 bits). (3) Split each 24-bit group into four 6-bit values. (4) Map each 6-bit value (0–63) to the Base64 alphabet: 0–25 β†’ A–Z, 26–51 β†’ a–z, 52–61 β†’ 0–9, 62 β†’ +, 63 β†’ /. (5) If the last group has fewer than 3 bytes, pad with = so the output length is a multiple of 4. For example, "Hi" is two bytes (72, 105); padded to three bytes and encoded gives a 4-character Base64 string. This tool does that for you: type or paste text, click Encode to Base64, and copy the result.

3 bytes (24 bits) β†’ 4 Base64 characters. So encoded size is about 4/3 β‰ˆ 133% of the original.

How to decode Base64 to text

To decode Base64 to text: (1) Remove any spaces or line breaks from the Base64 string. (2) Check that the string contains only A–Z, a–z, 0–9, +, /, and = (padding only at the end). (3) Check that the length is a multiple of 4; if not, the string is invalid. (4) Replace each Base64 character with its 6-bit value, then regroup into 8-bit bytes (four characters β†’ three bytes). (5) Decode the byte sequence as UTF-8 to get the original text. If the bytes are not valid UTF-8 (e.g. the Base64 was encoding binary, not text), you may see an error or replacement characters. This converter validates input and shows Invalid Base64 format when the string is malformed or the decoded bytes are not valid UTF-8, so you never see gibberish.

Pasting a string that ends in = or == may trigger auto-decode so you see the decoded text without clicking. For manual control, use Encode to Base64 or Decode to Text.

Why does Base64 increase size by about 33%?

Base64 uses 4 characters to represent 3 bytes (24 bits). So for every 3 bytes of input you get 4 characters of output: 4 Γ· 3 β‰ˆ 1.333, or about a 33% size increase. That’s why embedding binary data (or long text) as Base64 in JSON or HTML can make payloads larger. This converter shows the byte size of both input and output and the percentage difference (e.g. Size: 92 B (+33.3%)) so you can see the expansion. When you decode, the output is smaller than the Base64 string, so you’ll see a negative percentage (e.g. -24.5%).

When to use Base64 encoding

APIs and JSON: Many APIs send binary data (e.g. images, certificates) as Base64 strings inside JSON. Data URLs: Inline images in HTML or CSS use data:image/png;base64,.... Email: Attachments are often Base64-encoded in MIME. Basic auth: HTTP Basic Authentication sends username:password as Base64 (not secure by itselfβ€”use HTTPS). Storing binary in text-only systems: Databases or config files that don’t support raw bytes sometimes store Base64. Use this tool to encode to Base64 or decode Base64 to text when you need to inspect or produce such strings quickly.

Why must Base64 length be a multiple of 4?

Base64 encodes 3 bytes into 4 characters. So the number of characters must be divisible by 4 so that every block of 4 characters decodes to a whole number of bytes. If you have 1 or 2 bytes left over, the standard adds padding: one = for 2 bytes in the last block, two = for 1 byte. So valid Base64 always has length 4, 8, 12, … (or with padding, e.g. …= or …==). If the string (after removing spaces) has a length that isn’t a multiple of 4, it’s invalid and this converter shows Invalid Base64 format. That rule also prevents plain English (or other text) from being mistaken for Base64 when it happens to use only letters and numbers.

Base64 Converter FAQ

? What is Base64 encoding and why is it used?

Base64 encoding converts binary data (or text as bytes) into a string of 64 printable ASCII characters (A–Z, a–z, 0–9, +, /) plus = for padding. It is used when you need to embed binary or non-ASCII data in formats that only allow textβ€”e.g. JSON, XML, email (MIME), data URLs, and HTTP headers. Base64 is not encryption; it can be decoded by anyone. This converter encodes text to Base64 and decodes Base64 to text using UTF-8.

? How do I encode text to Base64?

Paste or type your text in the input panel and click Encode to Base64. The tool converts the text to UTF-8 bytes, then to Base64. The result appears in the output panel; use Copy output to copy it. Character count and byte size under the input show the raw size; the output panel shows the encoded size and the percentage increase (about +33% for Base64).

? How do I decode Base64 to text?

Paste your Base64 string in the input and click Decode to Text. If the string ends in = or == and has valid Base64 characters, the tool may auto-decode and show the text. Valid Base64 uses only A–Z, a–z, 0–9, +, /, and =; length (after removing spaces) must be a multiple of 4. If the string is invalid or the decoded bytes are not valid UTF-8, you’ll see Invalid Base64 format instead of gibberish.

? Why must Base64 string length be a multiple of 4?

Base64 encodes 3 bytes as 4 characters. So the total number of characters must be divisible by 4 so each block of 4 decodes to a whole number of bytes. Short blocks are padded with one or two =. If the length isn’t a multiple of 4 (after stripping spaces), the string isn’t valid Base64 and the decoder will show an error. This rule also helps avoid accidentally β€œdecoding” plain text that only uses letters and numbers.

? Does Base64 support UTF-8 and emojis?

Yes. This converter uses UTF-8 for both encoding and decoding. When you encode, text is converted to UTF-8 bytes (so emojis and any Unicode character use one to four bytes), then those bytes are Base64-encoded. When you decode, the Base64 is turned back into bytes and then interpreted as UTF-8. So you can encode and decode text in any language, including emojis, without corruption.

? Why does Base64 increase size by about 33%?

Base64 represents 3 bytes (24 bits) as 4 characters from a 64-character set. So 3 bytes β†’ 4 characters; the ratio is 4/3 β‰ˆ 1.333, or about 33% larger. The tool shows this as a percentage next to the output size (e.g. Size: 92 B (+33.3%)). When decoding, the output is smaller than the Base64 string, so you’ll see a negative percentage.

? What characters are allowed in Base64?

The Base64 alphabet has 64 characters: A–Z (26), a–z (26), 0–9 (10), plus + and /. Padding uses = at the end (one or two characters) so the total length is a multiple of 4. Any other character (spaces, newlines, or invalid symbols) should be removed before decoding; this tool strips spaces automatically. URL-safe Base64 uses - and _ instead of + and /; if you have that variant, replace - with + and _ with / before pasting here.

? Is Base64 encryption?

No. Base64 is encoding, not encryption. Anyone can decode a Base64 string with a standard decoder (or this tool). It obfuscates data for systems that only accept text; it does not protect secrets. For passwords or sensitive data, use proper encryption (e.g. AES) and key management. Base64 is often used to represent encrypted data or tokens after they are already encrypted or signed.