Quick access

Saved in this browser. Sign in to keep it on all your devices.

Binary Converter

Turn text into binary, hex, and decimal bytes and back again, or convert a number between binary, octal, decimal, and hexadecimal.

Text and bytes

8-bit groups
Base 16, one byte per pair
Byte values 0–255

Number base converter

Whole numbers of any size
Base 2
Base 8
Base 10
Base 16

Prefixes such as 0b, 0o and 0x are accepted. Spaces and underscores between digits are ignored.

Quick Reference

A

65 | 01000001

a

97 | 01100001

0

48 | 00110000

Space

32 | 00100000

4
Formats
2-way
Conversion
100%
Free
0
Sign-up
Version 1.1 Updated What's new

Release notes

  1. v1.1 Latest
    • Added an in-depth guide below the tool, written from what the tool actually does.
    • Text is now converted as UTF-8 bytes, so accented letters, other scripts and emoji come out right.
    • You can now type in the binary, hex or decimal box without it rewriting itself as you go.
    • Added a number base converter for binary, octal, decimal and hexadecimal.

About the Binary Converter

The binary converter translates text into the 0s and 1s computers store, and converts numbers between binary (base 2), decimal (base 10), and hexadecimal (base 16).

How to use it

  1. 1 Type text or a number into any box.
  2. 2 The other formats update as you type.
  3. 3 Copy whichever format you need.

Frequently asked questions

How is text converted to binary?

Each character is turned into its character code (UTF-8 bytes), and each byte is written as 8 binary digits. "A" is 65, which is 01000001.

How do I convert binary to decimal?

Multiply each digit by 2 raised to its position, counting from 0 on the right, and add them up. 1011 is 8 + 0 + 2 + 1 = 11.

Why is hexadecimal used?

One hex digit stands for exactly 4 binary digits, so hex is a compact way to write binary. FF in hex is 11111111 in binary and 255 in decimal.

How the text boxes turn letters into bytes

Text is first encoded as UTF-8, the encoding used by almost every web page and modern file. Each byte is then written three ways: as eight binary digits, as two hexadecimal digits, and as a decimal number from 0 to 255. Edit any of the four boxes and the other three follow, while the box you are typing in keeps its cursor.

English letters, digits and punctuation take one byte each, so “Hi” is 01001000 01101001. Other characters need more:

  • é is two bytes: C3 A9.
  • The euro sign € is three bytes: E2 82 AC. So is each Bangla, Hindi or Chinese character.
  • Most emoji are four bytes: 😀 is F0 9F 98 80.

The byte count above the boxes shows the total, which is the size the text would take in a UTF-8 file or database column.

Reading eight binary digits by hand

Each position in a byte has a fixed value. From left to right they are 128, 64, 32, 16, 8, 4, 2 and 1. Add up the values where the digit is 1:

0 1 0 0 1 0 0 0
  64      8        = 72  → "H"
0 1 1 0 1 0 0 1
  64 32   8     1  = 105 → "i"

Hexadecimal is shorter because one hex digit stands for exactly four binary digits. Split 01001000 into 0100 and 1000, which are 4 and 8, and you get 48. That is why programmers read memory, colours and file contents in hex rather than in long runs of 0s and 1s.

When your result differs from another converter

Some converters work on UTF-16 code units, the way JavaScript stores strings, instead of UTF-8 bytes. For plain English the two agree. For é an older tool may print 11101001 (233), its Latin-1 code, where this one prints 11000011 10101001. Both are correct for their encoding, but only the UTF-8 version matches what a web page, an email or a .txt file really contains.

In the binary, hex and decimal boxes, separate the bytes with spaces or commas. Leading zeros are optional, so 1000001 is read as 01000001 (A). A group that cannot be a byte, such as 256 or nine binary digits, gets a message instead of a wrong letter. Bytes that do not form valid UTF-8 show up as �.

Converting a single number between bases

The number converter on the right is separate from the text boxes. Type one whole number in binary, octal, decimal or hex and the others update. There is no size limit: 18446744073709551615 converts to FFFFFFFFFFFFFFFF exactly, a number too large for an ordinary calculator to hold without rounding. Prefixes such as 0b, 0o and 0x are accepted, and spaces or underscores between digit groups are ignored.

Where each base turns up in practice:

  • Binary: bit flags, subnet masks (255.255.255.0 is 24 ones followed by 8 zeros) and digital electronics.
  • Octal: Unix file permissions. 755 is 111 101 101, read, write and run for the owner and read and run for everyone else.
  • Hexadecimal: colour codes such as #FF8800, memory addresses, hashes and Unicode code points.

Negative numbers and fractions are not converted. Computers usually store a negative whole number as two’s complement, where −1 in one byte is 11111111, and the byte width has to be known before that pattern means anything.