Back to Home 100% Free

Text to Binary & Base64

Encode and decode text values in Binary or Base64 formats.

Input Content

Chars: 0 Bytes: 0 Bytes Bits: 0 Bits

Conversion Result

Chars: 0 Bytes: 0 Bytes Bits: 0 Bits
Output Copied!

Understanding Binary Data & Base64 Representation

When developers build applications, store data structures, or communicate across network frameworks, they deal with various data formatting configurations. Converting between plain characters (text), base-2 binary bytes (octets), and base-64 text blocks is a fundamental process in developer workflows.

How Encoding & Decoding Works

1

Text to Binary Bytes

Your text is first passed through the browser's UTF-8 encoder to get its real byte sequence, then every byte is rendered as an 8-bit binary chunk, left-padded to exactly 8 bits: 01000001 for the byte representing 'A' (decimal 65). For plain ASCII text (English letters, digits, common punctuation) each character maps to exactly one 8-bit byte. For characters outside the ASCII range — accented letters, CJK text, emoji — UTF-8 represents that one character using two, three, or four separate bytes, so you'll see multiple 8-bit chunks for a single character. This mode is a strict byte-for-byte UTF-8 dump, the same UTF-8-safe approach the Base64 mode uses.

2

Text to Base64 Text Blocks

Base64 groups raw bytes into sets of 3 (24 bits) and splits them into 4 blocks of 6 bits. Each 6-bit chunk maps to one of 64 characters: A-Z, a-z, 0-9, +, /. If the final block has fewer than 3 bytes, padding (=) is added. Unlike the Binary mode above, this converter first runs your text through a proper UTF-8 byte-encoding step (via encodeURIComponent) before Base64-encoding it, so multi-byte characters, accented letters, and emoji are converted correctly and round-trip back to the exact original text.

3

Decoding Process

Decoding works in reverse: Base64 decoding takes the 6-bit index symbols, merges them into 8-bit bytes, and then reverses the UTF-8 byte-decoding step to reconstruct the original text exactly (emoji and all). Binary decoding takes each space-separated group of bits, converts each one back to a numeric byte value, and reverses the same UTF-8 byte-decoding step to rebuild the original text.

Why Browser-Based Conversion is Safer

Zero Network Exposure

External APIs can log requests, exposing API keys, API credentials, or private configuration blocks. Doing all conversions locally in your browser sandbox protects your files.

Exact Bitwise Translations

Supports proper bit-shifting operations, preventing text truncation or encoding mismatch issues that can arise in older converters.

Instant Offline Processing

Once downloaded, the tool performs conversions in microseconds. It runs completely offline without needing active network connections.

Step-by-Step: How to Use the Four Conversion Modes

The toolbar above the input and output panels exposes four distinct modes, and switching between them relabels the input/output panels and clears both boxes so you always know exactly which direction you're converting:

  1. Text to Base64 — type or paste plain text on the left, and the Base64-encoded string appears instantly on the right as you type. This is the mode to use when you need to embed data inside JSON, XML, a URL query parameter, or a data URI.
  2. Base64 to Text — paste a Base64 string (for example, a JWT segment, an API response field, or an encoded config value) and the decoded plain text appears on the right. If the string isn't valid Base64, the output panel reports "Invalid Base64 string!" instead of silently showing garbage.
  3. Text to Binary — converts each character of your input into a space-separated sequence of binary digits, useful for teaching computer-science fundamentals or inspecting exactly how a short string is represented at the bit level.
  4. Binary to Text — paste space-separated binary octets (like 01001000 01000101 01001100 01001100 01001111) and get the reconstructed text back. Each token must be valid binary (only 0s and 1s, 1–8 bits per token, since each token represents one UTF-8 byte); anything else triggers an "Invalid Binary string!" message rather than a wrong answer.

Every mode also supports three convenience actions: Import File reads a local .txt, .json, or .md file straight into the input box (you can also drag a file onto the input panel — a purple overlay confirms the drop zone is active), Copy Output puts the result on your clipboard in one click, and Download File saves the output as a timestamped .txt file. The character, byte, and bit counters below each textarea update live and are computed with Blob byte-size measurements, so the "Bytes" figure reflects real UTF-8 byte length rather than just the JavaScript string's character count — useful for confirming exactly how much a piece of text will actually weigh once transmitted or stored.

Exactly What This Converter Supports (and What It Doesn't)

To be precise about capabilities: this tool converts between plain text, Base64, and binary (bit-string) representations. It does not currently offer a hexadecimal conversion mode — if your workflow needs text-to-hex or hex-to-binary specifically, you'll want a dedicated hex converter instead. Within its four supported modes, here is exactly how faithfully each one round-trips real-world text:

Input Type Text ⇄ Base64 Text ⇄ Binary
ASCII text (English, digits, punctuation)Round-trips exactlyRound-trips exactly (one 8-bit byte per character)
Accented Latin letters (é, ñ, ü)Round-trips exactlyRound-trips exactly (standard 2-byte UTF-8 sequence)
Non-Latin scripts (Arabic, Chinese, Urdu)Round-trips exactlyRound-trips exactly (standard multi-byte UTF-8 sequence)
EmojiRound-trips exactlyRound-trips exactly (standard 4-byte UTF-8 sequence)

In short: both the Base64 and Binary modes are fully UTF-8 safe. Base64 achieves this because the encoder deliberately runs text through encodeURIComponent/decodeURIComponent before and after the Base64 step — this is the standard, well-known trick for making JavaScript's native btoa/atob (which technically only understand single-byte Latin-1 characters) safe for arbitrary Unicode. The Binary mode gets there more directly, using the browser's built-in TextEncoder/TextDecoder to convert text to and from its real UTF-8 byte sequence before rendering each byte as 8-bit binary. That means the binary strings this mode produces are textbook-accurate UTF-8 byte binary — every chunk is exactly 8 bits, and any character outside the ASCII range simply produces multiple 8-bit chunks, exactly as a strict byte-level UTF-8 encoder would.

Real-World Use Cases

Debugging API Payloads

Many REST and GraphQL APIs return Base64-encoded fields (attachments, binary blobs, encoded IDs). Paste the value here to see the human-readable content without writing a throwaway script.

Inspecting JWT Segments

A JSON Web Token's header and payload are Base64Url-encoded JSON. Decoding the middle segment here (after swapping -/_ back to +//) reveals the claims inside.

Building Data URIs

Small embedded images and fonts in CSS/HTML often use data: URIs built from a Base64-encoded file — encode small text-based assets here before hand-assembling the URI.

Computer Science Education

The Binary mode is a clean, visual way to show students exactly how a short word or name becomes a sequence of 0s and 1s, one UTF-8 byte at a time.

Common Mistakes & Gotchas

Why Base64 Adds Roughly 33% Overhead

The size increase isn't an implementation quirk — it's a direct consequence of the math behind the encoding. Base64 represents every 3 raw bytes (24 bits) using 4 output characters (4 × 6 bits = 24 bits), so the output is always 4/3 the length of the input before padding, which works out to a 33.3% size increase. A 300 KB file becomes roughly 400 KB once Base64-encoded. This matters in practice whenever you're deciding whether to embed a Base64 string directly (in a data URI, a JSON field, or an email attachment using MIME) versus linking to a raw binary file — the convenience of inlining data comes at a real bandwidth and storage cost, which is why Base64 is generally reserved for small assets (icons, short tokens, small config blobs) rather than large media files.

Padding characters (=) exist purely to keep the output length a clean multiple of 4 when the input isn't evenly divisible by 3 bytes: one trailing = means the last group had 2 input bytes, and two trailing == means the last group had only 1 input byte. Some contexts (URL query strings, filenames, and Base64Url as used in JWTs) strip padding entirely and swap +// for -/_ because those two characters have reserved meaning in URLs — that's exactly the transformation described in the FAQ below for building URL-safe Base64 by hand from this tool's output.

This Tool vs. Command-Line & Language-Native Alternatives

Every mainstream programming environment ships its own Base64 utilities — the base64 command on Linux/macOS, Python's base64 module, Node's Buffer.from(str).toString('base64'), and PowerShell's [Convert]::ToBase64String. Those are the right choice when Base64 conversion is one step inside an automated script or pipeline. This browser-based tool fills a different, complementary need: a zero-install way to eyeball a single value during debugging, without opening a terminal, without worrying about shell-escaping special characters, and without installing a runtime just to decode one string someone pasted into a support ticket or a Slack message. Because the underlying algorithm (RFC 4648) is a public standard, output produced by any of those command-line tools will decode correctly here, and vice versa — there is no proprietary variation in how the Base64 alphabet or padding rules are applied.

Where Base64 Came From — and Where You'll Still Find It

Base64 wasn't designed for the web at all — it originates from MIME (Multipurpose Internet Mail Extensions), the 1990s standard that made it possible to send images, attachments, and non-English text over email systems that were originally built to carry only 7-bit ASCII. By re-encoding arbitrary binary data as a restricted set of 64 printable ASCII characters, MIME guaranteed an attachment would survive being routed through mail servers that might otherwise mangle high-bit or control characters. That same "make binary data safe for a text-only channel" idea is why Base64 quietly shows up everywhere in modern software decades later: HTTP Basic Authentication headers, embedded image data URIs in CSS and HTML, the header and payload segments of JSON Web Tokens, binary attachments in JSON APIs, encoded certificates in PEM files, and configuration values in Docker and Kubernetes secrets. Understanding Base64 is less about one specific format and more about recognizing this one recurring pattern across nearly every layer of the web stack.

Privacy & Data Handling

Every conversion in this tool — Base64 encode/decode, binary encode/decode, and file import/export — is handled entirely by JavaScript running in your browser tab using built-in browser APIs (btoa, atob, FileReader, Blob). There is no fetch or XHR call anywhere in the conversion logic, meaning the text, credentials, tokens, or files you paste or upload are never transmitted to any server, logged, or stored remotely. Uploaded files are read locally via the browser's File API and immediately discarded from memory when you navigate away or refresh the page; nothing persists beyond your current tab session. This makes the tool safe to use even with sensitive values — API keys, session tokens, internal config snippets — that you would not want to paste into a random third-party web service of unknown provenance.

Frequently Asked Questions

What is Base64 encoding used for?

Base64 encoding translates binary byte objects into text-safe ASCII characters. It is primarily used to transmit complex data (like images, keys, or scripts) over formats designed to handle plain text safely (like XML, JSON, or URL paths) without transmission loss.

Is Base64 encoding a form of encryption?

No. Base64 is merely an encoding scheme designed for data conversion and representation. It provides zero security or confidentiality since anyone can instantly decode the Base64 string back to its original plain text.

How does text to binary conversion work?

It first UTF-8 encodes your text into raw bytes (using the browser's TextEncoder), then renders each byte as an 8-bit binary chunk. Every character — including accented letters, non-Latin scripts, and emoji — is represented using real UTF-8 byte sequences, so a single non-ASCII character may produce two, three, or four 8-bit chunks instead of one.

Does the converter support emojis and special character sets?

Yes. Both the Base64 and Binary modes run input through UTF-8-safe byte encoding first, so non-ASCII characters, international scripts, and emojis all encode and decode back to the exact original text. In Binary mode, each character maps to one or more standard 8-bit UTF-8 bytes rather than a single wider chunk.

Does the converter send my data to a remote server?

No. All conversions happen entirely in your web browser using client-side JavaScript. Your plain texts, credentials, or encoded strings never touch any external network API.

What is the meaning of the '=' padding symbol in Base64?

The equals sign '=' is used as a padding character at the end of a Base64 string. Because Base64 groups characters in blocks of 4 (representing 3 bytes), padding is appended to ensure the string length is a multiple of 4.

Can I upload text files directly to convert?

Yes. You can drag and drop or upload .txt, .json, or .md files. The file content is read locally and populated directly in the editor for instant translation.

Does Base64 encoding change the size of the data?

Yes. Base64 encoding increases the file size by approximately 33%. This is because it represents 3 bytes of raw data using 4 text characters.

Can I convert binary bytes back to plain text?

Yes. Paste a series of 8-bit binary numbers separated by spaces into the input, select 'Binary to Text', and the tool will instantly translate the bytes back to characters.

Is Base64 safe for URL parameters?

Standard Base64 contains '+' and '/' characters, which have special meanings in URLs. If you need URL-safe encoding, swap '+' for '-' and '/' for '_', and omit '=' padding.

Open Tool