consolelog.tools

Text to Binary

Convert text to binary, hex, octal, or decimal — UTF-8 aware so emoji & accents encode correctly. Live.

About this ToolHow it works, benefits & use cases

Text to Binary encodes any text into binary, hexadecimal, octal, or decimal, one number per byte or code unit. Unlike naive converters that read characters as UTF-16 code units, this tool uses TextEncoder for UTF-8 by default, so emoji and accented characters encode to the correct multi-byte sequences and round-trip cleanly — a 🚀 becomes its real four-byte UTF-8 representation, not a broken surrogate. You can also choose UTF-16 code units if you need that view. Pick the output base, set the separator (space, dash, newline, or none), and for hex toggle uppercase digits. Each unit is zero-padded to a consistent width for the chosen base and encoding. Live size readouts show the number of code units, bytes, and bits as you type. The input and settings are captured in a shareable URL, and all encoding happens in your browser with nothing uploaded.

How to Use

  1. 1Choose the output Base — Binary, Hexadecimal, Octal, or Decimal.
  2. 2Pick the Encoding (UTF-8, recommended, or UTF-16 code units) and a Separator between units.
  3. 3For hexadecimal output, optionally enable "Uppercase hex".
  4. 4Type or paste your text into the input, or click "Load example" to try emoji and accented text.
  5. 5Read the live Code units / Bytes / Bits stats, then copy or download the encoded output, or share the URL.

Key Benefits

  • Four output bases — binary, hex, octal, and decimal — from one tool
  • UTF-8 aware via TextEncoder, so emoji and accents encode and round-trip correctly
  • Optional UTF-16 code-unit view when you need it
  • Choice of separators (space, dash, newline, or none) and uppercase hex digits
  • Consistent zero-padding per base and encoding for clean, aligned output
  • Live counts of code units, bytes, and bits as you type
  • Shareable URL and fully client-side encoding with no upload

Common Use Cases

  • Visualizing how text is stored as UTF-8 bytes for teaching or debugging
  • Producing binary or hex dumps of strings for low-level protocol or firmware work
  • Checking the exact byte length of a string before sending it over the wire
  • Generating decimal or octal escape sequences for use in other languages
  • Confirming an emoji encodes to the expected multi-byte UTF-8 sequence

Options

0 characters · live

Enter text above to see the encoded output.

Was this tool helpful?

Share Your Experience

Help others discover this tool!

Related tools