Convert numbers between binary, octal, decimal, hexadecimal and any base 2–36 — all at once, with step-by-step solutions. Plus a bitwise calculator, two's complement converter and ASCII code lookup for programmers.
✓ 100% private — runs entirely in your browser, nothing is uploadedType a number in any base — every base updates live. Prefixes 0b, 0o, 0x are auto-detected, and arbitrarily large integers work.
Popular conversions, all handled above: hex to decimal · decimal to hex · binary to decimal · decimal to binary · binary to hex · hex to binary · octal to decimal · decimal to octal · binary to octal · octal to binary · hex to octal · octal to hex — or any base to any base (2–36).
Every conversion above, shown the way you would do it by hand — positional expansion into decimal, then repeated division out of decimal.
AND, OR, XOR, NOT and shifts on integers in any base. Results are masked to the selected bit width — just like fixed-width CPU registers.
Encode a signed decimal as a two's complement bit pattern, or decode a pattern back to its signed and unsigned values.
| Width | Signed min | Signed max | Unsigned max |
|---|
Type one character to see its code in every base. Boundary: this converts character codes between number bases — for turning whole text strings into hex or base64 (text encoding), use a dedicated text encoder instead.
Every hex digit is exactly 4 bits — memorize this table and you can read hex as binary at sight.
| Binary | Decimal | Hex |
|---|
| Power | Decimal | Hex | Common name |
|---|
| Decimal | Hex | Octal | Binary | Meaning |
|---|
255 is the largest unsigned 8-bit value. Repeated division: 255÷2 leaves remainders 1,1,1,1,1,1,1,1 → 11111111₂. In octal: 255÷8 = 31 r7, 31÷8 = 3 r7, 3÷8 = 0 r3 → 377₈. In hex: 255÷16 = 15 r15 → FF₁₆.
Positional expansion with D=13, E=14, A=10:
Start from +5 = 00000101, invert every bit → 11111010, add 1 → 11111011. Check: 11111011₂ = 251 unsigned; 251 − 256 = −5 signed. ✓
Use positional expansion: write each bit's place value (powers of 2) and add them up. For example, 1011 in binary = 1×8 + 0×4 + 1×2 + 1×1 = 8 + 0 + 2 + 1 = 11 in decimal. Read the bits from right to left as 2⁰, 2¹, 2², 2³ and multiply each bit by its place value. The converter above shows every step automatically when you enter a binary number.
Use repeated division by 2 and read the remainders bottom-up. For example, 13 in decimal: 13÷2=6 r1, 6÷2=3 r0, 3÷2=1 r1, 1÷2=0 r1 → remainders 1,0,1,1 read bottom-up give 1101 in binary. Check: 8+4+0+1=13. The step-by-step panel above performs this division chain for any number and any target base.
Multiply each hex digit by its place value (powers of 16) and add. Digits A–F count as 10–15. For example, 0x2F = 2×16 + 15×1 = 32 + 15 = 47 in decimal. A longer example: 0xDEAD = 13×4096 + 14×256 + 10×16 + 13 = 57005. The expansion steps are shown automatically in the converter above.
Divide repeatedly by 16 and read the remainders bottom-up, writing 10–15 as A–F. For example, 255 in decimal: 255÷16=15 r15 (F), 15÷16=0 r15 (F) → FF in hexadecimal. Larger example: 57005÷16 gives remainders 13,10,14,13 → D,E,A,D → 0xDEAD. Use the step-by-step section above to see the full division chain.
0xFF is 255 in decimal. Each F is 15, so 15×16 + 15 = 240 + 15 = 255. 0xFF is the maximum value of one unsigned byte (8 bits all set: 11111111 in binary, 377 in octal). It appears constantly in programming — for example as a bitmask or the alpha channel in colors like #FFFFFF.
255 in binary is 11111111 (eight 1s). Since 255 = 128+64+32+16+8+4+2+1, every one of the 8 bit positions is set. In octal it is 377 and in hexadecimal it is FF. It is the largest value that fits in an unsigned 8-bit byte.
0x is the conventional prefix marking a hexadecimal (base-16) literal, used in C, Python, JavaScript, Rust and most other languages — 0xFF means hex FF, i.e. 255. Related prefixes: 0b for binary (0b1010 = 10) and 0o for octal (0o17 = 15) in Python and newer JavaScript. A plain leading 0 (like 017) means octal in C but is best avoided because it is easy to misread. This converter auto-detects 0b, 0o and 0x prefixes.
Hexadecimal is a compact shorthand for binary: each hex digit maps to exactly 4 bits, so one byte is always exactly two hex digits (0x00–0xFF). Long binary strings like 1101111010101101 become the much more readable 0xDEAD. It is used for memory addresses, color codes (#FF5733), bitmasks, UUIDs and debugging raw bytes — anywhere humans need to read binary conveniently.
One hexadecimal digit holds exactly 4 bits (a nibble), because 16 = 2⁴. That is why hex lines up so neatly with binary: 0x0–0xF covers 0000–1111, and every byte (8 bits) is two hex digits. Octal digits, by comparison, hold 3 bits each, which is why octal was popular on older 12/24/36-bit machines and hex won on 8-bit-byte machines.
Multiply the fraction by 2 repeatedly and read off the integer parts top-down. For example, 0.625: 0.625×2=1.25 → 1, 0.25×2=0.5 → 0, 0.5×2=1.0 → 1, giving 0.101 in binary. Not every decimal fraction terminates in binary — 0.1 becomes the repeating 0.0001100110011…, the reason floating-point numbers like 0.1 + 0.2 are not exactly 0.3 in most languages. This converter shows up to 12 fractional digits.
Two's complement is how almost all modern CPUs store signed integers. To negate a number: invert every bit (one's complement) and add 1. For example, -5 in 8 bits: 5 = 00000101 → invert → 11111010 → add 1 → 11111011. The top bit acts as the sign bit, zero has a single representation, and addition/subtraction work identically for signed and unsigned values — which is why hardware uses it. The two's complement panel above encodes and decodes 8/16/32/64-bit values.
One's complement negates by flipping every bit (5 = 00000101 → -5 = 11111010); two's complement flips the bits and adds 1 (-5 = 11111011). One's complement has two zeros (+0 = 00000000 and −0 = 11111111) and needs end-around-carry in addition, so modern hardware universally uses two's complement, which has a single zero and reuses the same adder circuit for signed and unsigned math.
They compare numbers bit by bit: AND gives 1 only where both bits are 1; OR gives 1 where either bit is 1; XOR gives 1 where the bits differ. Example with 0xF0 (11110000) and 0xCC (11001100): AND = 0xC0 (11000000), OR = 0xFC (11111100), XOR = 0x3C (00111100). NOT flips every bit within the chosen width. Shifts move bits left (×2 per position) or right (÷2), with logical shift filling zeros and arithmetic shift preserving the sign bit. Try them in the bitwise calculator above.
A logical right shift always fills the vacated top bits with 0, so it treats the value as unsigned. An arithmetic right shift replicates the sign bit, preserving negativity for two's complement numbers. Example in 8 bits: 11111011 (−5) shifted right by 1 logically gives 01111101 (125, wrong for signed math), arithmetically gives 11111101 (−3, correct floor of −5÷2). In C and Java, >> on signed integers is arithmetic; >>> is the logical shift.
Look up each byte's character code: the character 'A' is code 65, which is 0x41 in hex, 101 in octal and 1000001 in binary. This tool converts single character codes between bases and includes the full ASCII table (codes 0–127) with control-character names. Note the boundary: this is number-base conversion of character codes — for converting whole text strings to hex or base64 (text encoding), use a dedicated text encoder instead.
Unsigned: 8-bit holds 0–255 (0xFF), 16-bit 0–65,535 (0xFFFF), 32-bit 0–4,294,967,295 (0xFFFFFFFF). Signed (two's complement): 8-bit holds −128 to 127, 16-bit −32,768 to 32,767, 32-bit −2,147,483,648 to 2,147,483,647. Overflow wraps around silently in most languages — 255 + 1 in an unsigned byte becomes 0. The two's complement section above shows the exact range for any width.
All integer arithmetic uses arbitrary-precision integers (JavaScript BigInt), so values of any size convert exactly — there is no 32-bit or floating-point rounding on the integer part. Fractions convert with up to 12 digits after the point using exact rational arithmetic (numerator/denominator as big integers), then truncate. Bitwise operations mask results to the selected width (8/16/32/64 bits), matching fixed-width register behavior. No data leaves your browser: there are no network requests, analytics scripts or cookies.
This is a number-base converter: numbers between numeral systems. It is not a text encoder — converting whole strings to hex/base64 or hashing text are different tools with different intents.
Free tool by NRTechStudio
Explore similar converters tools and calculators. 100% free, accurate, and runs completely in your browser without sign-up.
2 taps, no typing needed — diagnostics are sent automatically.