Any base 2β36, fractions, and two's complement β with the working shown.
Base b β decimal. Positional expansion: every digit is worth its face value times the base raised to its position, counting from 0 at the right.
Decimal β base b. Repeated division. Divide by b, write down the remainder, repeat on the quotient until it reaches 0 β then read the remainders upward.
The fraction. Repeated multiplication, the mirror image. Multiply by b, take the whole part as the next digit, repeat on what is left β and read downward.
When both bases are powers of two, do not go via decimal. The bits line up: three to an octal digit, four to a hex digit. Group them and read off.
This is the method networking uses on a MAC address and on every IPv6 field, and it is what an exam is asking for when it says "convert". Going via decimal gets the same answer with working nobody uses.
A negative number has no minus sign in a register β it has a width and a pattern. At width n:
Invert-and-add-one is the same operation, and it is the one written by hand:
The same eight bits are 243 unsigned and β13 signed. Nothing in the bits says which β the width and the mode do. Above, decimal is the value and every other base shows the stored pattern.
The table you end up memorising. 2ΒΉβ° is the one to anchor on; every subnet mask and every host count comes off it.
Prefixes 0b 0o 0d 0x, and the
separators _, spaces and : anywhere β plus -
inside a hex number, because MAC addresses are written 00-1B-44.
Digits are 0-9 then A-Z, which runs out at base 36. Anything
above that needs a bracket notation like [12].[35].[7], which is a
different tool, so this one refuses rather than inventing one.
A digit that does not belong to the base is named, with its position, instead of being quietly parsed into something else.