Binary converter

Convert binary to decimal, hex, octal and text instantly, or between any bases from 2 to 36. Free, exact for numbers of any size, and private.

Binary, decimal, hex & octal converter

Type in any field and the rest update instantly. Press / to focus, ↑ ↓ to step.

base 2

base 10

base 16

base 8

Bit length
6
Bytes
1
Set bits
3
Sign
Positive

Grouped binary

0010 1010

Positional breakdown

42 = 2⁵ + 2³ + 2¹ = 32 + 8 + 2

Fixed-width registers

Negative values use two's complement
WidthBinaryHexFits as
8-bit0010 10100x2Asigned · unsigned
16-bit0000 0000 0010 10100x002Asigned · unsigned
32-bit0000 0000 0000 0000 0000 0000 0010 10100x0000002Asigned · unsigned
64-bit0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0010 10100x000000000000002Asigned · unsigned

Text to binary converter

UTF-8 encoding, so accents and emoji work too. Edit either side.

Byte format

Why use this binary converter

  • Arbitrary precision

    BigInt math, so 256-bit hashes convert exactly.

  • Two's complement

    See 8, 16, 32 and 64-bit signed patterns.

  • Runs in your browser

    Conversions happen on your device. No sign-up.

Bit playground

Click bits to flip them. The highlighted bit is the sign bit for signed values.

Register width
Unsigned
42
Signed
42
Hex
0x2A
Octal
0o52
Tools

Binary tools for every conversion

Dedicated pages with focused options and a step-by-step explanation of how each result is worked out.

Guide

How to use the binary converter

Four tools, one page. Here's how to get the most out of each.

  1. Enter a value

    Type or paste a number into any field. Prefixes like 0b, 0o and 0x are fine, and spaces or underscores are ignored.

    Example:0x2Abecomes42

    Open converter
  2. Read the breakdown

    Below the fields you get the bit length, the set bits, the powers-of-two sum and the two's complement pattern for 8 to 64-bit registers.

    Example:-1becomes1111 1111

    See the details
  3. Encode text

    Write text on the left to get its UTF-8 bytes in binary, hex, decimal or octal. Paste bytes on the right to decode them.

    Example:Hibecomes01001000 01101001

    Convert text
  4. Flip bits

    Toggle bits in an 8, 16 or 32-bit register and watch the unsigned, signed and hex values change. Send the result to the converter.

    Example:1000 0000becomes−128

    Open playground
Keyboard shortcuts
  • /Focus the converter
  • ↑↓Step the value by 1
  • Shift↑↓Step by 16
Reference

Binary conversion cheat sheet

Handy tables and the two methods behind every conversion on this page.

Binary → decimal

sum of powers

Each digit is worth twice the one to its right. Add up the weights of the 1 bits.

  1. 12⁵32
  2. 02⁴16
  3. 12³8
  4. 02²4
  5. 12¹2
  6. 02⁰1

32 + 8 + 2 = 42

Decimal → binary

divide by 2

Divide by 2 until you reach 0. The remainders, read bottom-up, are the bits.

DivisionQuotientRemainder
42 ÷ 2210
21 ÷ 2101
10 ÷ 250
5 ÷ 221
2 ÷ 210
1 ÷ 201

42 = 1010102

0 to 15

one nibble
DecimalBinaryOctalHex
0000000
1000111
2001022
3001133
4010044
5010155
6011066
7011177
81000108
91001119
10101012A
11101113B
12110014C
13110115D
14111016E
15111117F

Powers of two

2ⁿ
nValueHexNote
2⁰10x1
2¹20x2
2²40x4
2³80x8
2⁴160x10nibble
2⁷1280x80int8 limit
2⁸2560x100byte
2¹⁰1,0240x4001 KiB
2¹⁵32,7680x8000int16 limit
2¹⁶65,5360x10000uint16
2²⁰1,048,5760x1000001 MiB
2²⁴16,777,2160x1000000RGB
2³⁰1,073,741,8240x400000001 GiB
2³¹2,147,483,6480x80000000int32 limit
2³²4,294,967,2960x100000000uint32
2⁵³9,007,199,254,740,9920x20000000000000JS safe int
2⁶⁴18,446,744,073,709,551,6160x10000000000000000uint64
Learn

A fast, exact binary converter for developers and students

What binary is, how each conversion works, and how to get the most out of these tools.

A binary converter changes numbers from one number system to another, most often between binary (base 2) and the decimal numbers we use every day. This binary converter goes further. It converts binary, decimal, hexadecimal and octal side by side, supports every base from 2 to 36, turns text into binary code and back, and shows the two's complement form a computer uses to store negative numbers. Everything runs in your browser, so results appear as you type and nothing you enter leaves your device.

What is binary?

Binary is a number system with only two digits, 0 and 1. Each digit is called a bit, and each position is worth twice the one to its right: 1, 2, 4, 8, 16, 32 and so on. The binary number 101010 means one 32, no 16, one 8, no 4, one 2 and no 1, which adds up to 42. Eight bits make a byte, which can hold 256 different values, from 0 to 255. Computers use binary because their circuits have two stable states, on and off, which map naturally onto 1 and 0. Every number, letter, image and instruction a computer handles is ultimately stored as a pattern of bits.

How to convert binary to decimal

To convert binary to decimal, multiply each bit by its place value and add the results. Working from the right, the place values are 2⁰ = 1, 2¹ = 2, 2² = 4 and upward. For 1101, that's 8 + 4 + 0 + 1 = 13. The binary converter at the top of this page does this instantly for numbers of any length and draws the positional breakdown, so you can check each step. For binary fractions such as 1101.101, the positions after the binary point are worth 0.5, 0.25, 0.125 and so on, giving 13.625. The dedicated binary to decimal converter handles fractions exactly and can also read a value as a signed two's complement pattern.

How to convert decimal to binary

Converting decimal to binary works in reverse. Divide the number by 2, write down the remainder, and repeat with the quotient until it reaches zero. Reading the remainders from bottom to top gives the binary result. For 42, the remainders are 0, 1, 0, 1, 0 and 1, so 42 in binary is 101010. Fractions use a second method: multiply the fractional part by 2 and record the whole-number part each time. Some decimal fractions, such as 0.1, never end in binary and repeat forever, which is why 0.1 + 0.2 isn't exactly 0.3 in most programming languages. The decimal to binary converter shows both methods step by step and marks the repeating bits.

Binary, hexadecimal and octal

Hexadecimal (base 16) and octal (base 8) are compact ways to write binary. Because 16 is 2⁴, every hex digit stands for exactly four bits, so converting binary to hex is a matter of splitting the bits into groups of four, starting from the right. The binary number 11111111 becomes FF, and 0x2F expands to 0010 1111. Octal works the same way with groups of three bits, because 8 is 2³. Programmers meet hex in memory addresses, byte dumps and color codes such as #FF8000, while octal is still used for Unix file permissions like 755. Use the hex to binary, binary to hex, octal to binary and binary to octal converters to see every digit next to its bits, or the hex converter to turn hex into decimal or text. For a single value with every step shown, try the hex to decimal and decimal to hex converters, and the chmod calculator for file permissions.

Text to binary and binary to text

Text is stored as numbers too. This binary converter encodes text as UTF-8, the standard used by nearly every website and modern program. Each character becomes one or more bytes, and each byte is shown as eight bits. The letter A is 65, or 01000001, and the word Hi is 01001000 01101001. Accented letters usually take two bytes and most emoji take four, so a single emoji is 32 bits. Try the text to binary converter to see every character's bytes, or paste binary code into the binary to text translator to decode it back into readable text, with or without spaces between the bytes. For plain 7-bit ASCII codes, use the ASCII to binary and binary to ASCII converters, or look a code up in the ASCII table. To translate in both directions at once, use the binary translator.

Negative numbers and two's complement

Mathematically, a negative number in binary simply gets a minus sign: −13 is −1101. Computers, though, store signed whole numbers using two's complement in a fixed number of bits. To find the two's complement of a negative number, write its size in binary, invert every bit and add 1. In 8 bits, 42 is 00101010, the inverted form is 11010101, and adding 1 gives 11010110, which is −42. The converter above shows the 8, 16, 32 and 64-bit patterns for any value, and the two's complement calculator explains every step in both directions. To add, subtract, multiply or divide in binary, or to try AND, OR, XOR, NOT and bit shifts, use the binary calculator.

Why use this binary converter?

  • Exact results for any size. Conversions use arbitrary-precision integers, so long values such as 256-bit hashes convert digit for digit, with no rounding.
  • Every base in one place. Binary, decimal, hex and octal update together as you type, and a custom field covers any base from 2 to 36.
  • Explanations, not just answers. Place values, division steps, grouped bits and worked examples show how each result is reached.
  • Runs in your browser. Every conversion is calculated on your device, so results appear instantly and there's no account to create.
  • Free and fast. Results update as you type, and the tools keep working even if your connection drops after the page has loaded.

Who uses a binary converter?

Students use a binary converter to check computer science, digital electronics and math homework, and to learn how number systems work. Programmers convert values while debugging, writing bit masks, reading register dumps or working with network protocols and file formats. Electronics hobbyists switch between binary and hex when programming microcontrollers. And anyone curious about how computers represent information can type a word into the text to binary converter and see exactly which bits it becomes.

Tips for accurate conversions

  • Paste values with prefixes such as 0b, 0o and 0x, and use spaces or underscores to group digits, like 1111_0000.
  • Use the arrow keys in any number field to step the value up or down by 1, or hold Shift to step by 16. Press / to jump straight to the converter.
  • Use Copy link to share or bookmark the exact number you're looking at.
  • Browse all binary tools for focused converters with step-by-step explanations and worked examples.

Whether you need a quick binary to decimal conversion, want to translate text into binary code or are learning how two's complement works, this binary converter gives you an exact answer and shows the reasoning behind it.

FAQ

Frequently asked questions

Quick answers about number bases, two's complement and text encoding.

How do I convert binary to decimal?

Give each bit a weight: the rightmost bit is worth 1, the next 2, then 4, 8, 16 and so on. Add up the weights of the bits that are 1.

For example, 101010 is 32 + 8 + 2 = 42. Or just type the binary value into the Binary field and read the Decimal field.

How do I convert decimal to binary?

Divide the number by 2 and write down the remainder. Repeat with the quotient until it reaches 0, then read the remainders from bottom to top.

42 gives the remainders 0, 1, 0, 1, 0, 1, so 42 is 101010 in binary. The cheat sheet above walks through every step.

How do I convert binary to hexadecimal?

Split the bits into groups of four, starting from the right, and pad the leftmost group with zeros. Each group maps to one hex digit from 0 to F.

101010 becomes 0010 1010, which is 2A. Octal works the same way with groups of three bits.

How are negative numbers handled?

The input fields use a minus sign, so −42 is shown as -101010 in binary. The fixed-width table shows how the same value is stored in an 8, 16, 32 or 64-bit register using two's complement.

To get the two's complement of a value, invert every bit of its positive form and add 1. In 8 bits, 42 is 00101010, inverting gives 11010101, and adding 1 gives 11010110, which is −42.

How does text to binary work?

Text is encoded as UTF-8 bytes, and each byte is shown in the format you pick. Plain ASCII characters take one byte, so A is 01000001. Accented letters usually take two bytes and most emoji take four.

You can also paste bytes into the right-hand box to decode them. If the bytes don't form valid UTF-8, you'll see a warning and the broken parts show as �.

Which bases and formats are supported?

Any base from 2 to 36. Digits go 0–9 and then a–z, so base 36 uses all ten digits and the whole alphabet. Input isn't case-sensitive, and the Uppercase switch controls how letters are displayed.

You can type the prefixes 0b, 0o and 0x, and use spaces or underscores as separators, like 1111_0000.

Is there a size limit? Can I convert fractions?

Conversions use arbitrary-precision integers, so large values such as 256-bit hashes convert exactly, with no rounding. Each field accepts up to 4,096 characters.

This converter handles whole numbers only. For fractions such as 10.625, use Decimal to Binary or Binary to Decimal.

Is my data sent anywhere?

No. Every conversion runs in your browser, and nothing you type is sent to a server or stored.

The current number is added to the page address (for example ?n=255) so you can bookmark or share it, and anyone you send the link to will see it. Click Clear to remove it.