Glyph WidgetsGlyph Widgets
关于联系博客隐私条款在Ko-fi上支持

© 2026 Glyph Widgets. 保留所有权利。

·

100% 客户端处理

返回博客

Binary Text Converter: Text to Binary

Binary Text Converter converts text to binary or hexadecimal and decodes binary/hex back to text. Unicode support, configurable separators.

Glyph Widgets
2026年2月27日
10 min read
binary to texttext to binarybinary converterhex to texttext to hex

What Is Binary Text Converter?

Binary Text Converter is a free online tool that converts plain text to binary (base-2) or hexadecimal (base-16) representations, and decodes binary or hex strings back into readable text. It uses UTF-8 encoding, meaning it correctly handles the full Unicode character set — English letters, accented characters, Arabic, Chinese, emoji, and any other text that can be encoded in UTF-8.

The tool is used by developers inspecting byte-level data, students learning about character encoding, and anyone who needs to verify that a string's binary or hex representation matches expectations. All computation happens locally in your browser; nothing is sent to a server. The tool is free with no account required.

Key Features

  • Text to binary conversion — Encodes each UTF-8 byte of the input as an 8-bit binary string (01001000 for the ASCII letter H).
  • Binary to text conversion — Decodes a binary string (groups of 8 bits, separated by spaces or whitespace) back into text.
  • Hexadecimal support — Encode text to uppercase hex pairs (48 for H) or decode hex pairs back to text.
  • Configurable separators — In encode mode, choose whether byte values are separated by a space, no separator, or a newline. This controls the readability and format of the output.
  • Input validation — In decode mode, the tool immediately validates the input. Binary input must contain only 0 and 1 characters in groups of 8. Hex input must contain only valid hex characters (0-9, A-F, a-f) in pairs. A visual indicator shows valid/invalid status.
  • Unicode/UTF-8 support — Uses the browser's built-in TextEncoder and TextDecoder APIs. Multi-byte characters (accented letters, CJK, emoji) are correctly encoded to multiple bytes and decoded back without loss.
  • Real-time conversion — Output updates on every keystroke.
  • Swap button — Moves the current output to the input field and switches the mode (encode becomes decode, decode becomes encode) in one click.
  • Copy to clipboard — One-click copy of the output.
  • Batch mode — Process multiple strings at once (supporter feature).

How to Use Binary Text Converter

Step 1: Select Mode

Two mode buttons appear at the top: Text to Binary (encode) and Binary to Text (decode).

  • Select Text to Binary if you have readable text and want its binary or hex representation.
  • Select Binary to Text if you have a binary or hex string and want to recover the original text.

Step 2: Select Format

Two format buttons: Binary and Hexadecimal.

  • Binary produces or expects 8-bit binary strings (01001000 01100101 01101100 01101100 01101111 for Hello).
  • Hexadecimal produces or expects uppercase hex pairs (48 65 6C 6C 6F for Hello).

Step 3: Choose a Separator (Encode Mode Only)

When encoding, three separator options are available:

OptionEffectExample output for hi
SpaceBytes separated by spaces01101000 01101001
NoneNo separator, bytes run together0110100001101001
Line BreakEach byte on its own line01101000\n01101001

The separator option is hidden in decode mode because the decoder strips all whitespace before processing, accepting any separator format.

Step 4: Enter Your Input

Paste or type your content into the Input textarea. The output appears in the Output panel immediately.

Encoding example:

Input (text): Hello Format: Binary, separator: Space

Output: 01001000 01100101 01101100 01101100 01101111

Decoding example:

Input (binary): 01001000 01100101 01101100 01101100 01101111 Mode: Binary to Text

Output: Hello

Unicode encoding example:

Input (text): café Format: Hexadecimal, separator: Space

Output: 63 61 66 C3 A9

The é character is encoded as two bytes (C3 A9) because it is a multi-byte UTF-8 character.

Step 5: Validate Input in Decode Mode

When decode mode is active and you have typed input, a validation indicator appears in the options bar:

  • ✓ Valid input (green) — the input passes validation and can be decoded.
  • ✗ Invalid input (red) — the input contains characters that cannot be decoded. The input textarea border also turns red.

For binary, validation requires: only 0 and 1 characters (whitespace ignored), total bit count divisible by 8. For hex, validation requires: only hex characters (whitespace ignored), total character count divisible by 2.

Step 6: Use Swap to Round-Trip

After encoding, click the Swap / Switch Mode button to move the encoded output into the input, switch to decode mode, and verify you get the original text back. This is useful as a quick round-trip sanity check.

Practical Examples

Debugging a Network Protocol

A protocol sends binary payloads. You have captured 01001000 01100101 01101100 01101100 01101111 00100001 and need to know what it says. Select Binary to Text, paste the binary, and read Hello! in the output.

Verifying Character Encoding for Internationalized Text

You are testing that your application correctly handles a French string. Enter façade in encode mode with hexadecimal format. The output 66 61 C3 A7 61 64 65 confirms that ç is encoded as two bytes (C3 A7) as expected for UTF-8. Compare this against your application's actual byte output to verify they match.

Teaching Binary Encoding to Students

Demonstrate how letters map to bits. Enter a single character (A) and show students the binary output: 01000001. Change the character to a (lowercase) and observe 01100001. The difference at bit position 5 (0 versus 1) illustrates the ASCII/Unicode relationship between uppercase and lowercase letters.

Tips and Best Practices

Whitespace in decode input is ignored. The decoder strips all whitespace (spaces, tabs, newlines) before processing. This means binary input separated by spaces, newlines, or no separator at all is handled identically. You do not need to reformat binary input before pasting.

Hexadecimal output uses uppercase letters. The tool always outputs hex in uppercase (A through F). When decoding, it accepts both uppercase and lowercase input (6F and 6f both decode to o).

Multi-byte characters produce multiple output groups. A 4-byte emoji like 😀 produces 4 binary groups (11110000 10011111 10011000 10000000) or 4 hex pairs (F0 9F 98 80). This is correct UTF-8 encoding. When you decode those bytes back, you get the original emoji.

Use the None separator for compact output. If you need binary output without spaces (for example, to paste into a tool that expects a continuous bitstring), select None. Decoding accepts this format too.

The Swap button saves a copy step. After encoding, instead of manually copying, switching mode, and pasting, click Swap once. The output moves to input, mode toggles, and you can decode immediately.

Common Issues and Troubleshooting

"Invalid binary input. Must contain only 0s and 1s in groups of 8." The decoder throws this error when the binary string has a bit count not divisible by 8 (a partial byte), or when non-binary characters are present. Check for any stray letters, digits other than 0 or 1, or punctuation in the input.

"Invalid hex input. Must contain valid hex characters in pairs." Thrown when hex input has an odd number of characters (after whitespace removal), or contains characters outside 0-9A-Fa-f. A common cause is accidentally including a space-separated value that has an odd number of digits per token.

Output shows garbled characters. This usually means the source data was not UTF-8 encoded. The tool uses TextDecoder with its default UTF-8 encoding. If the original bytes came from a Latin-1 or Windows-1252 encoded source, the decoded text will differ from the original.

Input validation shows invalid but the input looks correct. Check that the total bit count is divisible by 8. A binary string of 17 characters (after stripping whitespace) is invalid because 17 is not a multiple of 8. Even one extra 0 or 1 makes the input invalid.

Copy button is disabled. The Copy button is disabled when the output is empty. This happens when the input is empty or when decoding has failed with an error. Resolve the validation error first, then copy.

Privacy and Security

Binary Text Converter runs entirely in your browser. Encoding uses the browser's built-in TextEncoder API; decoding uses TextDecoder. Neither API makes network requests. No text or binary data is transmitted to any server. The tool has no server-side component for conversion. It operates offline once the page is loaded.

Frequently Asked Questions

Is Binary Text Converter free? Yes, free with no account required. The core encode/decode functionality is fully available at no cost. Supporter features (presets, history, batch mode) require a Glyph Widgets supporter subscription.

Does it work offline? Yes. The conversion uses browser-native APIs (TextEncoder, TextDecoder). Once the page loads, no internet connection is needed.

Is my text safe? Your text is never sent to any server. All processing is local JavaScript. No external service is contacted.

What character encoding does it use? UTF-8, via the browser's TextEncoder and TextDecoder APIs. This means all Unicode characters are supported correctly, including emoji and characters outside the Basic Multilingual Plane.

Why does é produce two hex pairs instead of one? Because é (U+00E9) is encoded in UTF-8 as two bytes: 0xC3 0xA9. UTF-8 encodes code points above U+007F using multiple bytes. The Binary Text Converter correctly reflects this multi-byte encoding.

Can I decode binary that uses a separator other than spaces? Yes. The decoder strips all whitespace before processing, so binary separated by spaces, tabs, newlines, or no separator at all is handled identically.

What is the difference between binary and hexadecimal output? Both represent the same underlying bytes. Binary shows each byte as 8 bits (e.g., 01001000). Hexadecimal shows each byte as 2 hex digits (e.g., 48). Hex is more compact — a 5-character word like Hello produces 40 binary characters (plus separators) vs. 14 hex characters (plus separators). Binary is more explicit for educational purposes; hex is more common in developer contexts.

Does the tool support emoji? Yes. Emoji are multi-byte UTF-8 characters. They encode to 3 or 4 bytes each and decode back to the original emoji without loss.

Can I convert multiple strings at once? Yes, using Batch Mode (supporter feature). Enter one string per line in the batch input. The tool applies the current mode and format settings to each line and displays results in a table.

Why does the hexadecimal output use uppercase letters? The byte.toString(16) call is combined with .toUpperCase() in the source code. This is a common convention — RFC standards and many debugging tools display hex in uppercase. The decoder accepts both uppercase and lowercase input.

Related Tools

  • Base64 Encoder/Decoder — Another common encoding format for binary data in text contexts.
  • Character Counter — Count characters, bytes, and code points in your text before encoding.
  • Case Converter — Change the case of text before or after conversion.

Try Binary Text Converter now: Binary Text Converter

最后更新:2026年2月27日

继续阅读

更多文章试用 Binary Text Converter