Five converters for the ways numbers are written, each in its own tab:
- Bases. Type a number in any base from 2 to 36 and read it in binary, octal, decimal, hexadecimal and one more base of your choice. Whole numbers are converted with exact big-integer arithmetic, so a 600-digit number comes out right to the last digit. A fractional part is converted exactly too: the digits either end, or a block repeats forever and is shown in brackets.
- Two's complement. Pick 8, 16, 32 or 64 bits and see the same bit pattern as a signed and an unsigned number, in hex and in binary, with the "invert and add one" steps for a negative value and the pattern sign-extended to wider types.
- IEEE 754 float. See how a decimal is stored as a 32-bit float or a 64-bit double: sign, exponent, fraction, the kind of value (normal, subnormal, zero, infinity, NaN), every digit of the value actually stored, and the rounding error. It also works backwards, from hex bits to the value.
- Roman numerals from 1 to 3999 in both directions, with a strict check of the standard form, and the vinculum form up to 3,999,999.
- Morse code both ways, following ITU-R M.1677-1, with sound you can play at a chosen speed.
How to use the bases tab
- Type the number. Spaces and underscores are ignored, so
1111_0000 and FF FF work. A minus sign is allowed. - Choose the base it is written in. In base 10 the prefixes
0b, 0o and 0x switch to binary, octal and hex. In base 16 they are not read as prefixes, because 0b1 is a perfectly good hex number (B1). - Read the results. Binary and hex are grouped in fours from the right, octal and decimal in threes; the copy buttons copy the digits without spaces.
Worked example: 255 is 1111 1111 in binary, 377 in octal, FF in hex and 73 in base 36 (7 × 36 + 3). Decimal 0.1 in binary is 0.0(0011): the block 0011 repeats forever, which is exactly why 0.1 cannot be stored exactly in a binary float. Decimal 3.14 in hex is 3.2(3D70A). If a fraction neither ends nor repeats within 64 digits, it is cut off, not rounded, and marked with "…".
Two's complement and floats, in short
An 8-bit pattern means 0 to 255 when read unsigned, or −128 to 127 when read signed: patterns with the top bit set stand for the value minus 256. So 1111 1011 is 251 unsigned and −5 signed. By hand, −5 is 5 (0000 0101), with the bits inverted (1111 1010), plus one (1111 1011). The tool refuses a value that does not fit, such as 128 in a signed 8-bit type, and names the limits. Widening a negative pattern copies the sign bit: −1 is FF in 8 bits and FFFF in 16.
A float stores a sign, a power of two and a fraction. Typing 0.1 as a float32 gives the bits 3DCCCCCD, whose exact value is 0.100000001490116119384765625, about 1.49 billionths too high. As a double the bits are 3FB999999999999A and the stored value is 0.1000000000000000055511151231257827021181583404541015625. The decimal is rounded once, to the nearest representable value with ties to even, from its exact value. That detail matters for float32: going through a double first can round twice and land one step off, which the tests check with a real example.
For the full story with hand-worked examples, read hex, binary and two's complement explained.
Roman numerals and Morse code
Roman numerals use the standard modern form: I, V, X, L, C, D, M, with only six subtractive pairs (IV, IX, XL, XC, CD, CM). A numeral like IIII or IC is refused with the standard spelling suggested (IV, XCIX). Above 3999 there is no single agreed form; the tool writes the thousands under a bar (the vinculum, ×1000), so 4000 is I̅V̅ and 12,345 is X̅I̅I̅CCCXLV. Some texts write extra M's instead, which is also seen.
Morse follows Recommendation ITU-R M.1677-1: the letters, figures and punctuation of its table, including é and @. The multiplication sign is sent as X and a percent sign as 0/0, as the recommendation says; anything else is listed as having no signal. A dot lasts 1200 ÷ WPM milliseconds, from the standard word PARIS, which is exactly 50 dot lengths. Farnsworth spacing keeps letters fast and stretches only the gaps, which helps when learning to copy by ear.
Everything runs in your browser. For text encodings rather than numbers, see the Base64 encoder; for arithmetic with powers and logs, the scientific calculator; for hex colour codes, the colour tools.