One converter for every number base
Choose what you are converting from and to, then type. The result you asked for appears in the highlighted box, and every other representation (binary, octal, decimal, hexadecimal, a custom base, text and Base64) is listed underneath, so you rarely need a second tool. Values of any length are converted exactly: a 300-digit decimal number or a 4,000-bit hex string is no problem, because the converter uses arbitrary-precision integers rather than JavaScript’s 53-bit numbers. Invalid digits are reported with their position, for example a 2 in a binary number or a G in hex.
How positional notation works
Every base works the same way. A number is a row of digits, and each position is worth the base raised to a power, counting from 0 on the right. In decimal (base 10) the number 347 means 3×100 + 4×10 + 7×1. In binary (base 2) the positions are worth 1, 2, 4, 8, 16 and so on, so 1011 means 1×8 + 0×4 + 1×2 + 1×1 = 11. Octal uses powers of 8 and the digits 0–7; hexadecimal uses powers of 16 and needs six extra digits, A–F, for the values 10–15. Bases above 16 simply continue through the alphabet, up to base 36, where Z means 35.
| Base | Name | Digits | Place values | 255 written in it |
|---|---|---|---|---|
| 2 | Binary | 0 1 | 1, 2, 4, 8, 16… | 11111111 |
| 8 | Octal | 0–7 | 1, 8, 64, 512… | 377 |
| 10 | Decimal | 0–9 | 1, 10, 100, 1000… | 255 |
| 16 | Hexadecimal | 0–9, A–F | 1, 16, 256, 4096… | FF |
| 36 | Base 36 | 0–9, A–Z | 1, 36, 1296… | 73 |
Worked examples for each conversion
Binary to decimal
Multiply each bit by its place value and add. For 110101: 32 + 16 + 0 + 4 + 0 + 1 = 53. A quicker way for long numbers is doubling: start at 0 and, for each bit from the left, double the total and add the bit (0→1→3→6→13→26→53).
Decimal to binary, octal and hex
Divide repeatedly by the target base and read the remainders from bottom to top. 53 ÷ 2 gives remainders 1, 0, 1, 0, 1, 1, so 53 = 110101. The same method with 8 gives 65, and with 16 gives 35. For 3735928559 ÷ 16 the remainders spell DEADBEEF.
Binary to hex and octal (and back)
No arithmetic is needed. Each hex digit is exactly four bits and each octal digit exactly three, so split the binary number into groups from the right: 1101 0101 is D5 in hex, and 11 010 101 is 325 in octal. To go back, expand each hex digit to four bits (F → 1111, 7 → 0111) or each octal digit to three.
Hex to decimal and octal
Hex 2F is 2×16 + 15 = 47. To reach octal, the easiest route is through binary: 2F = 0010 1111 = 101 111 = 57. Octal to hex works the same way in reverse.
Octal to decimal
Octal 755, the familiar Unix permission, is 7×64 + 5×8 + 5 = 493. Each octal digit is also one permission group: 7 = rwx, 5 = r-x.
Decimal to ASCII
Enter several decimal codes separated by spaces or commas and each one becomes a character: 72 101 108 108 111 reads Hello. Values above 127 are treated as Unicode code points, so 233 is é and 128512 is 😀.
Base64 to binary, hex and octal
Base64 is not a number base in the usual sense; it is a way of writing bytes with 64 printable characters. Choose Base64 as the input and the tool decodes it to bytes and shows each byte in binary, hex and octal: SGVsbG8= is the five bytes 48 65 6C 6C 6F, which is the text “Hello”.
Binary and hex to Base64
Going the other way, a binary string is cut into bytes (eight bits each, padded on the left) and a hex string into pairs of digits, and those bytes are encoded. 48656C6C6F in hex becomes SGVsbG8=. Leading zero bytes are kept, so 0001 in hex encodes as AAE=.
Negative numbers and two’s complement
Computers store signed integers in two’s complement: a negative number −n in a w-bit field is stored as 2w − n. In 8 bits, −5 is 256 − 5 = 251 = 11111011 = FB. The top bit doubles as a sign bit, and adding numbers works the same whether they are signed or not. Choose 8, 16, 32 or 64 bits in Signed to see the stored bit pattern of a negative decimal, or to read a binary or hex pattern such as FFFFFFFE as a signed value (−2 in 32 bits). The tool also shows the unsigned reading and warns when a value does not fit, for example −129 in 8 bits, whose range is −128 to 127. With Signed off, negative numbers are simply written with a minus sign in every base.
| Width | Signed range | −1 is stored as |
|---|---|---|
| 8-bit | −128 to 127 | FF |
| 16-bit | −32,768 to 32,767 | FFFF |
| 32-bit | −2,147,483,648 to 2,147,483,647 | FFFFFFFF |
| 64-bit | about ±9.22 × 1018 | FFFFFFFFFFFFFFFF |
Fractions: decimal to binary
For the part after the point, multiply by the target base and take the whole-number part as the next digit. 0.625 × 2 = 1.25 (digit 1), 0.25 × 2 = 0.5 (digit 0), 0.5 × 2 = 1.0 (digit 1), so 10.625 = 1010.101. Many decimal fractions never end in binary: 0.1 becomes 0.000110011001100… repeating forever, which is why 0.1 + 0.2 is not exactly 0.3 in most programming languages. Set Fraction digits to choose where to stop; a trailing … tells you the result was cut off. Fractional binary, octal and hex inputs convert back to exact decimals.
Grouping, case and multiple values
Long binary numbers are easier to read in groups: choose nibbles (four bits, one hex digit) or bytes (eight bits). Hex can be shown in upper or lower case. Spaces and commas in the input are treated automatically: in decimal they separate several values, while in binary and hex they are assumed to be digit grouping inside one number. Change Spaces and commas to override that. Links such as ?mode=binary-to-decimal or ?mode=decimal-to-ascii open the converter with that pair already chosen.
Conversion table 0–255
The first 16 values are worth memorizing; the full byte range is in the expandable table below.
| Dec | Hex | Binary | Dec | Hex | Binary |
|---|---|---|---|---|---|
| 0 | 0 | 0000 | 8 | 8 | 1000 |
| 1 | 1 | 0001 | 9 | 9 | 1001 |
| 2 | 2 | 0010 | 10 | A | 1010 |
| 3 | 3 | 0011 | 11 | B | 1011 |
| 4 | 4 | 0100 | 12 | C | 1100 |
| 5 | 5 | 0101 | 13 | D | 1101 |
| 6 | 6 | 0110 | 14 | E | 1110 |
| 7 | 7 | 0111 | 15 | F | 1111 |
Show the full 0–255 conversion table (decimal, hex, octal, binary, ASCII)
| Dec | Hex | Oct | Binary | ASCII |
|---|---|---|---|---|
| 0 | 00 | 000 | 00000000 | NUL |
| 1 | 01 | 001 | 00000001 | |
| 2 | 02 | 002 | 00000010 | |
| 3 | 03 | 003 | 00000011 | |
| 4 | 04 | 004 | 00000100 | |
| 5 | 05 | 005 | 00000101 | |
| 6 | 06 | 006 | 00000110 | |
| 7 | 07 | 007 | 00000111 | |
| 8 | 08 | 010 | 00001000 | |
| 9 | 09 | 011 | 00001001 | TAB |
| 10 | 0A | 012 | 00001010 | LF |
| 11 | 0B | 013 | 00001011 | |
| 12 | 0C | 014 | 00001100 | |
| 13 | 0D | 015 | 00001101 | CR |
| 14 | 0E | 016 | 00001110 | |
| 15 | 0F | 017 | 00001111 | |
| 16 | 10 | 020 | 00010000 | |
| 17 | 11 | 021 | 00010001 | |
| 18 | 12 | 022 | 00010010 | |
| 19 | 13 | 023 | 00010011 | |
| 20 | 14 | 024 | 00010100 | |
| 21 | 15 | 025 | 00010101 | |
| 22 | 16 | 026 | 00010110 | |
| 23 | 17 | 027 | 00010111 | |
| 24 | 18 | 030 | 00011000 | |
| 25 | 19 | 031 | 00011001 | |
| 26 | 1A | 032 | 00011010 | |
| 27 | 1B | 033 | 00011011 | |
| 28 | 1C | 034 | 00011100 | |
| 29 | 1D | 035 | 00011101 | |
| 30 | 1E | 036 | 00011110 | |
| 31 | 1F | 037 | 00011111 | |
| 32 | 20 | 040 | 00100000 | space |
| 33 | 21 | 041 | 00100001 | ! |
| 34 | 22 | 042 | 00100010 | " |
| 35 | 23 | 043 | 00100011 | # |
| 36 | 24 | 044 | 00100100 | $ |
| 37 | 25 | 045 | 00100101 | % |
| 38 | 26 | 046 | 00100110 | & |
| 39 | 27 | 047 | 00100111 | ' |
| 40 | 28 | 050 | 00101000 | ( |
| 41 | 29 | 051 | 00101001 | ) |
| 42 | 2A | 052 | 00101010 | * |
| 43 | 2B | 053 | 00101011 | + |
| 44 | 2C | 054 | 00101100 | , |
| 45 | 2D | 055 | 00101101 | - |
| 46 | 2E | 056 | 00101110 | . |
| 47 | 2F | 057 | 00101111 | / |
| 48 | 30 | 060 | 00110000 | 0 |
| 49 | 31 | 061 | 00110001 | 1 |
| 50 | 32 | 062 | 00110010 | 2 |
| 51 | 33 | 063 | 00110011 | 3 |
| 52 | 34 | 064 | 00110100 | 4 |
| 53 | 35 | 065 | 00110101 | 5 |
| 54 | 36 | 066 | 00110110 | 6 |
| 55 | 37 | 067 | 00110111 | 7 |
| 56 | 38 | 070 | 00111000 | 8 |
| 57 | 39 | 071 | 00111001 | 9 |
| 58 | 3A | 072 | 00111010 | : |
| 59 | 3B | 073 | 00111011 | ; |
| 60 | 3C | 074 | 00111100 | < |
| 61 | 3D | 075 | 00111101 | = |
| 62 | 3E | 076 | 00111110 | > |
| 63 | 3F | 077 | 00111111 | ? |
| 64 | 40 | 100 | 01000000 | @ |
| 65 | 41 | 101 | 01000001 | A |
| 66 | 42 | 102 | 01000010 | B |
| 67 | 43 | 103 | 01000011 | C |
| 68 | 44 | 104 | 01000100 | D |
| 69 | 45 | 105 | 01000101 | E |
| 70 | 46 | 106 | 01000110 | F |
| 71 | 47 | 107 | 01000111 | G |
| 72 | 48 | 110 | 01001000 | H |
| 73 | 49 | 111 | 01001001 | I |
| 74 | 4A | 112 | 01001010 | J |
| 75 | 4B | 113 | 01001011 | K |
| 76 | 4C | 114 | 01001100 | L |
| 77 | 4D | 115 | 01001101 | M |
| 78 | 4E | 116 | 01001110 | N |
| 79 | 4F | 117 | 01001111 | O |
| 80 | 50 | 120 | 01010000 | P |
| 81 | 51 | 121 | 01010001 | Q |
| 82 | 52 | 122 | 01010010 | R |
| 83 | 53 | 123 | 01010011 | S |
| 84 | 54 | 124 | 01010100 | T |
| 85 | 55 | 125 | 01010101 | U |
| 86 | 56 | 126 | 01010110 | V |
| 87 | 57 | 127 | 01010111 | W |
| 88 | 58 | 130 | 01011000 | X |
| 89 | 59 | 131 | 01011001 | Y |
| 90 | 5A | 132 | 01011010 | Z |
| 91 | 5B | 133 | 01011011 | [ |
| 92 | 5C | 134 | 01011100 | \ |
| 93 | 5D | 135 | 01011101 | ] |
| 94 | 5E | 136 | 01011110 | ^ |
| 95 | 5F | 137 | 01011111 | _ |
| 96 | 60 | 140 | 01100000 | ` |
| 97 | 61 | 141 | 01100001 | a |
| 98 | 62 | 142 | 01100010 | b |
| 99 | 63 | 143 | 01100011 | c |
| 100 | 64 | 144 | 01100100 | d |
| 101 | 65 | 145 | 01100101 | e |
| 102 | 66 | 146 | 01100110 | f |
| 103 | 67 | 147 | 01100111 | g |
| 104 | 68 | 150 | 01101000 | h |
| 105 | 69 | 151 | 01101001 | i |
| 106 | 6A | 152 | 01101010 | j |
| 107 | 6B | 153 | 01101011 | k |
| 108 | 6C | 154 | 01101100 | l |
| 109 | 6D | 155 | 01101101 | m |
| 110 | 6E | 156 | 01101110 | n |
| 111 | 6F | 157 | 01101111 | o |
| 112 | 70 | 160 | 01110000 | p |
| 113 | 71 | 161 | 01110001 | q |
| 114 | 72 | 162 | 01110010 | r |
| 115 | 73 | 163 | 01110011 | s |
| 116 | 74 | 164 | 01110100 | t |
| 117 | 75 | 165 | 01110101 | u |
| 118 | 76 | 166 | 01110110 | v |
| 119 | 77 | 167 | 01110111 | w |
| 120 | 78 | 170 | 01111000 | x |
| 121 | 79 | 171 | 01111001 | y |
| 122 | 7A | 172 | 01111010 | z |
| 123 | 7B | 173 | 01111011 | { |
| 124 | 7C | 174 | 01111100 | | |
| 125 | 7D | 175 | 01111101 | } |
| 126 | 7E | 176 | 01111110 | ~ |
| 127 | 7F | 177 | 01111111 | DEL |
| 128 | 80 | 200 | 10000000 | · |
| 129 | 81 | 201 | 10000001 | · |
| 130 | 82 | 202 | 10000010 | · |
| 131 | 83 | 203 | 10000011 | · |
| 132 | 84 | 204 | 10000100 | · |
| 133 | 85 | 205 | 10000101 | · |
| 134 | 86 | 206 | 10000110 | · |
| 135 | 87 | 207 | 10000111 | · |
| 136 | 88 | 210 | 10001000 | · |
| 137 | 89 | 211 | 10001001 | · |
| 138 | 8A | 212 | 10001010 | · |
| 139 | 8B | 213 | 10001011 | · |
| 140 | 8C | 214 | 10001100 | · |
| 141 | 8D | 215 | 10001101 | · |
| 142 | 8E | 216 | 10001110 | · |
| 143 | 8F | 217 | 10001111 | · |
| 144 | 90 | 220 | 10010000 | · |
| 145 | 91 | 221 | 10010001 | · |
| 146 | 92 | 222 | 10010010 | · |
| 147 | 93 | 223 | 10010011 | · |
| 148 | 94 | 224 | 10010100 | · |
| 149 | 95 | 225 | 10010101 | · |
| 150 | 96 | 226 | 10010110 | · |
| 151 | 97 | 227 | 10010111 | · |
| 152 | 98 | 230 | 10011000 | · |
| 153 | 99 | 231 | 10011001 | · |
| 154 | 9A | 232 | 10011010 | · |
| 155 | 9B | 233 | 10011011 | · |
| 156 | 9C | 234 | 10011100 | · |
| 157 | 9D | 235 | 10011101 | · |
| 158 | 9E | 236 | 10011110 | · |
| 159 | 9F | 237 | 10011111 | · |
| 160 | A0 | 240 | 10100000 | · |
| 161 | A1 | 241 | 10100001 | · |
| 162 | A2 | 242 | 10100010 | · |
| 163 | A3 | 243 | 10100011 | · |
| 164 | A4 | 244 | 10100100 | · |
| 165 | A5 | 245 | 10100101 | · |
| 166 | A6 | 246 | 10100110 | · |
| 167 | A7 | 247 | 10100111 | · |
| 168 | A8 | 250 | 10101000 | · |
| 169 | A9 | 251 | 10101001 | · |
| 170 | AA | 252 | 10101010 | · |
| 171 | AB | 253 | 10101011 | · |
| 172 | AC | 254 | 10101100 | · |
| 173 | AD | 255 | 10101101 | · |
| 174 | AE | 256 | 10101110 | · |
| 175 | AF | 257 | 10101111 | · |
| 176 | B0 | 260 | 10110000 | · |
| 177 | B1 | 261 | 10110001 | · |
| 178 | B2 | 262 | 10110010 | · |
| 179 | B3 | 263 | 10110011 | · |
| 180 | B4 | 264 | 10110100 | · |
| 181 | B5 | 265 | 10110101 | · |
| 182 | B6 | 266 | 10110110 | · |
| 183 | B7 | 267 | 10110111 | · |
| 184 | B8 | 270 | 10111000 | · |
| 185 | B9 | 271 | 10111001 | · |
| 186 | BA | 272 | 10111010 | · |
| 187 | BB | 273 | 10111011 | · |
| 188 | BC | 274 | 10111100 | · |
| 189 | BD | 275 | 10111101 | · |
| 190 | BE | 276 | 10111110 | · |
| 191 | BF | 277 | 10111111 | · |
| 192 | C0 | 300 | 11000000 | · |
| 193 | C1 | 301 | 11000001 | · |
| 194 | C2 | 302 | 11000010 | · |
| 195 | C3 | 303 | 11000011 | · |
| 196 | C4 | 304 | 11000100 | · |
| 197 | C5 | 305 | 11000101 | · |
| 198 | C6 | 306 | 11000110 | · |
| 199 | C7 | 307 | 11000111 | · |
| 200 | C8 | 310 | 11001000 | · |
| 201 | C9 | 311 | 11001001 | · |
| 202 | CA | 312 | 11001010 | · |
| 203 | CB | 313 | 11001011 | · |
| 204 | CC | 314 | 11001100 | · |
| 205 | CD | 315 | 11001101 | · |
| 206 | CE | 316 | 11001110 | · |
| 207 | CF | 317 | 11001111 | · |
| 208 | D0 | 320 | 11010000 | · |
| 209 | D1 | 321 | 11010001 | · |
| 210 | D2 | 322 | 11010010 | · |
| 211 | D3 | 323 | 11010011 | · |
| 212 | D4 | 324 | 11010100 | · |
| 213 | D5 | 325 | 11010101 | · |
| 214 | D6 | 326 | 11010110 | · |
| 215 | D7 | 327 | 11010111 | · |
| 216 | D8 | 330 | 11011000 | · |
| 217 | D9 | 331 | 11011001 | · |
| 218 | DA | 332 | 11011010 | · |
| 219 | DB | 333 | 11011011 | · |
| 220 | DC | 334 | 11011100 | · |
| 221 | DD | 335 | 11011101 | · |
| 222 | DE | 336 | 11011110 | · |
| 223 | DF | 337 | 11011111 | · |
| 224 | E0 | 340 | 11100000 | · |
| 225 | E1 | 341 | 11100001 | · |
| 226 | E2 | 342 | 11100010 | · |
| 227 | E3 | 343 | 11100011 | · |
| 228 | E4 | 344 | 11100100 | · |
| 229 | E5 | 345 | 11100101 | · |
| 230 | E6 | 346 | 11100110 | · |
| 231 | E7 | 347 | 11100111 | · |
| 232 | E8 | 350 | 11101000 | · |
| 233 | E9 | 351 | 11101001 | · |
| 234 | EA | 352 | 11101010 | · |
| 235 | EB | 353 | 11101011 | · |
| 236 | EC | 354 | 11101100 | · |
| 237 | ED | 355 | 11101101 | · |
| 238 | EE | 356 | 11101110 | · |
| 239 | EF | 357 | 11101111 | · |
| 240 | F0 | 360 | 11110000 | · |
| 241 | F1 | 361 | 11110001 | · |
| 242 | F2 | 362 | 11110010 | · |
| 243 | F3 | 363 | 11110011 | · |
| 244 | F4 | 364 | 11110100 | · |
| 245 | F5 | 365 | 11110101 | · |
| 246 | F6 | 366 | 11110110 | · |
| 247 | F7 | 367 | 11110111 | · |
| 248 | F8 | 370 | 11111000 | · |
| 249 | F9 | 371 | 11111001 | · |
| 250 | FA | 372 | 11111010 | · |
| 251 | FB | 373 | 11111011 | · |
| 252 | FC | 374 | 11111100 | · |
| 253 | FD | 375 | 11111101 | · |
| 254 | FE | 376 | 11111110 | · |
| 255 | FF | 377 | 11111111 | · |
Frequently asked questions
How do I convert binary to decimal?
Multiply each bit by its place value (1, 2, 4, 8 and so on from the right) and add the results. For example 1011 is 8 + 0 + 2 + 1 = 11. Choose Binary to Decimal above and the converter does it instantly, for numbers of any length.
How do I convert decimal to hexadecimal?
Divide the number by 16 repeatedly and write the remainders from last to first, using A to F for 10 to 15. For example 255 is FF and 3735928559 is DEADBEEF.
Can the converter handle very large numbers?
Yes. It uses arbitrary-precision integers, so numbers with hundreds or thousands of digits convert exactly without rounding.
How are negative numbers converted to binary?
With Signed off, a minus sign is kept, so -10 is -1010. With Signed set to 8, 16, 32 or 64 bits, the two’s complement pattern is shown, so -5 in 8 bits is 11111011 (FB).
Can I convert decimal codes to ASCII text?
Yes. Choose Decimal to Text and enter codes separated by spaces or commas, for example 72 101 108 108 111 gives Hello. Values above 127 are treated as Unicode code points.
How do I convert Base64 to hex or binary?
Choose Base64 as the input. The text is decoded to bytes and each byte is shown in hex, binary, octal and decimal, along with the decoded text.
Why does 0.1 become a long repeating binary number?
Because 1/10 cannot be written exactly with powers of two, just as 1/3 cannot be written exactly in decimal. The converter stops after the number of fraction digits you choose and marks the cut with an ellipsis.