MiServe DevTools

Your lid

Pin tools here. They are saved in this browser.

Text to Hex, Binary & Bytes Converter

See the same bytes as UTF-8 text, hexadecimal, binary, decimal, octal and Base64, and edit any of them to update the rest.

Separator between bytes
Binary group size

Runs in your browser. Nothing you paste is uploaded.

About this tool

One sequence of bytes, six ways to write it

A computer stores text as bytes, and a byte is a number from 0 to 255. Hexadecimal writes each byte as two digits (48), binary as eight bits (01001000), octal as three digits (110) and decimal as a plain number (72). All four are the same byte, which is the letter H in ASCII and in UTF-8. Base64 packs every three bytes into four printable characters.

The views on this page always show the same bytes. Type in any of them and the others are recomputed. If what you type cannot be read, that field is marked and the others keep their last valid content.

Characters are not bytes

The text view is encoded as UTF-8, where each code point takes one to four bytes. ASCII letters take one, é takes two (c3 a9), most CJK characters take three and most emoji take four or more. That is why the byte count and the character count differ.

The character count is the number of grapheme clusters, the units a reader perceives as one character, when the browser provides Intl.Segmenter. A family emoji is one grapheme made of several code points joined by zero-width joiners, so the code point count is shown as well.

Not every byte sequence is valid UTF-8. When you enter bytes that are not, the text view shows the replacement character U+FFFD in place of the invalid bytes and the tool warns you.

Input formats that are accepted

Bytes may be separated by spaces, line breaks, commas or underscores, and hex also by colons or hyphens, as in a MAC address. The prefixes 0x, \x, 0b and 0o are accepted, so you can paste the values of an array literal from source code, without its brackets. Digits written without separators are read at a fixed width: two hex digits, eight bits or three octal digits per byte.

A comma or a prefix always starts a new value, so 0b1000, 0b0001 is the two bytes 8 and 1. Binary written in groups of four with only spaces between them, such as 1000 0001, is read eight bits at a time and gives one byte.

The 0x prefix output style writes a comma-separated list such as 0x48, 0x65, ready to paste back into code. The binary and octal views use 0b and 0o in the same way, and the decimal view writes plain numbers. Decimal bytes have no fixed width, so they keep a space between them even when the separator is set to None.

Questions

How do I convert text to hexadecimal?

Each character is first encoded as bytes, here with UTF-8, and each byte is written as two hexadecimal digits. The word Hi becomes 48 69. Type the text in the first field and read the hex view.

Why does one character produce several bytes?

UTF-8 uses one byte only for ASCII. Accented letters such as é need two bytes, most Chinese, Japanese and Korean characters need three, and most emoji need four or more.

What does the � character in the text mean?

It is U+FFFD, the replacement character. It appears where the bytes are not valid UTF-8, for example when the data is binary or was written in another encoding such as Latin-1 or UTF-16.

Is my text sent to a server?

No. The conversion is done by JavaScript in your browser tab. What you type is not sent anywhere and is not stored.

More in Encoding