All Tools

Text to Binary, Hex and ASCII Converter, Free and Private

Convert text to binary, hexadecimal or decimal ASCII codes and back in your browser. UTF-8 aware, any separator, forgiving decoder. Nothing is uploaded.

Direction
Base
Separator

0 characters, 0 bytes

0 characters, 0 bytes


About the Text to Binary, Hex and ASCII Converter

The Text to Binary Converter shows the bytes behind any text as binary, octal, decimal, hexadecimal or any-base codes, or as a byte array ready to paste into code, and turns such codes back into text. It is the quickest way to answer questions like "what is this letter in binary", to decode a message written in ones and zeros, to read a hex dump, or to look up ASCII codes. Type on the left and the codes appear on the right as you go. Everything runs in your browser, nothing is uploaded, and your text never leaves your device.

How to convert

Text to codes

  1. Keep Direction on Text to codes and choose a Base: Binary for eight-digit groups, Octal for three-digit groups, Decimal for the familiar ASCII numbers, Hex for two-digit groups, Any base for a radix from 2 to 36, or Bytes for an array literal.
  2. Pick a Separator: a space between groups, a comma, a new line, or none at all for a continuous run.
  3. For hex, any base and bytes, turn on Upper case if you need 4A rather than 4a.
  4. Press Copy to copy the codes, or Swap to move them into the input and decode them again.

Codes to text

  1. Switch Direction to Codes to text and choose the base the codes are written in.
  2. Paste the codes. Spaces, commas, line breaks and 0b, 0o or 0x prefixes are all accepted, and a continuous run of fixed-width groups, such as bits, octal triples or hex pairs, is cut into bytes for you. With Bytes, paste a list such as [72, 105], an array such as {0x48, 0x69} or an escaped string such as "\x48\x69"; the brackets and quotes are optional.
  3. The text appears on the right. A group that is not a valid byte is named with its position in the list.

Octal, any base and byte arrays

Octal

Octal writes each byte as three digits from 000 to 377, so H is 110 and a newline is 012. It is the notation of Unix file permissions and of \110-style escapes in C and shell strings.

Any base from 2 to 36

Choose Any base and type a radix. Digits run from 0 to 9 and then a to z, and every byte is padded to the number of digits the largest byte, 255, needs in that base: eight in base 2, six in base 3, two in base 36. Fixed widths keep the groups aligned and let an unbroken run be split back into bytes.

Byte arrays

The Bytes format writes the whole text as one literal: a Decimal list [72, 105] for JavaScript or Python, a Hex array [0x48, 0x69] for C, Rust or Go, or an Escaped string \x48\x69 for a string literal. Decoding reads any of the three styles.

ASCII only

Turn on ASCII only when the data must stay within the 128 ASCII characters, for example in an old protocol, a fixed-width record or a test fixture. Instead of quietly writing the UTF-8 bytes of an accented letter or an emoji, the tool lists each character above U+007F with its code point and its position in the text. When decoding, every byte above 0x7F is named with its group number. The ASCII pages, such as ascii-to-octal or hex-to-ascii, open with this switch already on; the UTF-8 pages leave it off.

Privacy

The conversion happens entirely in your browser. Your text is never uploaded to our servers and nothing is kept once you close or reload the tab.

Bytes, not characters

UTF-8

Computers store text as bytes, and this tool shows the UTF-8 bytes, which is what the web, modern operating systems and most programming languages use. Plain English letters are one byte each, so H is 01001000, 48 in hex and 72 in decimal. Accented letters take two bytes and most emoji take four, which is why é becomes 195 169.

ASCII codes

For characters from 0 to 127, the decimal code is the classic ASCII code: 65 is A, 97 is a, 32 is a space. Beyond that range the numbers are UTF-8 bytes rather than single-character codes, so a pair or a quartet of numbers makes one character.

Decoding mistakes

A binary group longer than eight digits, a hex pair with a letter past f, or a decimal above 255 cannot be a byte and is reported by its group number. Codes that are valid bytes but do not form valid UTF-8, for example ff fe, are reported as not being text.

Common uses

  • Decoding a "secret message" written in binary.
  • Reading or writing hex dumps and escape sequences such as \x48\x69.
  • Looking up ASCII and UTF-8 codes while writing code or a protocol.
  • Teaching how text becomes bits.

Related tools

Go straight to Text to Hex, Text to Octal or the Binary to Text translator. To convert a number rather than text between bases, use the Number Base Converter. Base64 is the compact cousin of these codes; see the Base64 Encoder and Decoder. Percent-encoding for URLs lives in the URL Encoder and Decoder, and the Data Converter turns bits and bytes into kilobytes and megabytes.

Open-source credits

The conversion logic is implemented in-house in TypeScript, with no third-party library. Text is turned into bytes with the browser's built-in TextEncoder and TextDecoder, following the UTF-8 encoding defined in RFC 3629 and the WHATWG Encoding Standard. ASCII is the 128-character set of ANSI X3.4 (ISO/IEC 646 international reference version).

Frequently asked questions

Why does one letter sometimes become two or four binary groups?

The converter shows the UTF-8 bytes of the text, which is how the web and modern software store it. Plain English letters fit in one byte, accented letters such as é take two bytes and most emoji take four, so a single visible character can span several eight-bit groups.

Can I paste binary without spaces between the bytes?

Yes. When the input is one unbroken run of ones and zeros whose length is a multiple of eight, the decoder cuts it into bytes for you. The same applies to hex runs with an even number of digits. Spaces, commas, line breaks and 0b or 0x prefixes are also accepted.

What do the decimal codes mean?

Each number is the value of one byte, from 0 to 255. For characters in the ASCII range these are the classic ASCII codes, for example 65 for a capital A and 32 for a space. Above 127 the numbers are UTF-8 bytes, so two or more of them together make one character.

Why does the tool say a group is not a valid byte?

A byte holds at most eight binary digits, two hex digits or a decimal value up to 255. A group that breaks one of those rules, such as 300 in decimal or a nine-digit binary group, cannot be a byte, and the message names its position in the list so you can fix it.

Is anything I type sent to a server?

No. The conversion runs inside your browser and the page makes no network request with your text. Nothing is stored, and the input and output are gone when you close or reload the tab.

Other related tools