50% off Plus--d--h--m

Binary Converter

Type a number in binary, octal, decimal, hexadecimal or any base from 2 to 36, and the other boxes follow. You see the working for the box you typed in, two's complement at 8, 16, 32 and 64 bits, a row of bits to flip, binary arithmetic, and text turned into binary bytes and back.

  • No account needed
  • Free, no limits
  • Nothing is uploaded

How it works

  1. 01

    Type in any box

    Binary, octal, decimal, hex or a base of your choice, of any length, with spaces between digit groups if you like.

  2. 02

    Read the working

    Repeated division by 2, place values, or groups of four bits: the method your course uses, for the direction you typed.

  3. 03

    Go further

    Two's complement for negative numbers, binary arithmetic, and text to binary as UTF-8 bytes.

How it works

Number bases, step by step

Binary to decimal uses place values. Each binary digit is worth a power of 2, doubling from the right: 1, 2, 4, 8, 16 and so on. Multiply each digit by its place value and add: 101101 = 1×2⁵ + 0×2⁴ + 1×2³ + 1×2² + 0×2¹ + 1×2⁰ = 32 + 8 + 4 + 1 = 45. Hex to decimal works the same way with powers of 16, where A to F stand for 10 to 15: 7F = 7×16 + 15 = 127. Octal uses powers of 8.

Decimal to binary goes the other way, by repeated division. Divide by 2, write down the remainder (0 or 1), and divide the quotient again until it reaches 0. Then read the remainders from the bottom up: 156 ÷ 2 = 78 r 0, 78 ÷ 2 = 39 r 0, 39 ÷ 2 = 19 r 1, 19 ÷ 2 = 9 r 1, 9 ÷ 2 = 4 r 1, 4 ÷ 2 = 2 r 0, 2 ÷ 2 = 1 r 0, 1 ÷ 2 = 0 r 1, so 156 = 10011100. A fraction is converted by multiplying by 2 instead: each whole part is the next digit after the point. Many decimal fractions never end in binary (0.1 = 0.000110011…), so the converter shows 32 places and marks the cut with ….

Binary to hex needs no arithmetic: split the bits into groups of four from the point outwards, padding with zeros, and write each group as one hex digit, because 16 = 2⁴. 11010110 is 1101 0110, that is D6. Octal works the same with groups of three. Hex to binary reverses it: each hex digit becomes four bits. That is why programmers write long binary numbers in hex.

Computers store negative whole numbers in two's complement: with n bits, the range is −2ⁿ⁻¹ to 2ⁿ⁻¹ − 1, so 8 bits hold −128 to 127. To write −5 in 8 bits, write 5 as 00000101, flip every bit to 11111010 and add 1: 11111011. The text mode turns characters into their UTF-8 bytes, one byte for English letters and up to four for accents, other alphabets and emoji, and turns bytes back into text, saying where the bytes stop being valid. Numbers of any length are worked out exactly, in your browser.

FAQ

Questions, answered

Computer science revision that sticks

PocketNote turns your lecture notes into flashcards and practice questions you can study anywhere.