文本转二进制转换器

将文本转换为二进制(UTF-8)或将二进制转换回文本。每字节 8 位。不上传服务器。

查看指南

指南

What does this tool do

The Text to Binary Converter converts plain text to binary (0s and 1s) and back. Encode any UTF-8 text to 8-bit binary per byte, or decode a binary string to plain text. Supports optional spacing between bytes for readability. All processing runs in your browser—no server upload.

How to use it

  1. Choose mode — Switch between Text → Binary (encode) and Binary → Text (decode).
  2. Set separator (encode only) — Choose "Space between bytes" for readable output, or "No separator" for a continuous string.
  3. Enter input — For encode: type or paste text. For decode: paste a binary string (0s and 1s; spaces are ignored).
  4. View output — The result appears after clicking Convert. Invalid binary shows an error.
  5. Copy — Use the copy button to copy the output to the clipboard.

How it works

Encode: The input is encoded to UTF-8 via TextEncoder, then each byte is converted to an 8-bit binary string (zero-padded). Bytes can be joined with or without spaces. Decode: Spaces are stripped from the input, which must contain only 0 and 1. The string is split into 8-bit groups, converted to bytes, then decoded to UTF-8 via TextDecoder. Invalid binary (wrong characters, length not divisible by 8, invalid UTF-8) returns an error. Input is limited to 500KB to avoid heavy main-thread work.

All computation runs entirely in your browser. No data is sent to any server.

Use cases & examples

  • Learning — Understand how text is represented in binary.
  • Encoding — Encode messages or data for transmission.
  • Debugging — Inspect byte-level representation of strings.
  • Education — Teach ASCII/UTF-8 and binary representation.

Example

  • Encode Hello01001000 01100101 01101100 01101100 01101111 (with space)
  • Encode A01000001 (or 01000001 without separator)
  • Decode 01001000 01100101 01101100 01101100 01101111Hello

Limitations & known constraints

  • Input size — Maximum ~500KB (512,000 characters) to prevent browser slowdown.
  • Encoding — UTF-8 only; other encodings (e.g. Latin-1) not supported.
  • Binary format — 8 bits per byte; variable-length encodings (e.g. UTF-8 multi-byte sequences) are represented byte by byte.
  • Empty decode — Empty input in decode mode returns an error.

所有计算和转换均完全在您的浏览器中运行。不会向任何服务器发送数据,您的输入不会离开您的设备。