← Back to all posts

How does base conversion work? 2/8/10/16 and big numbers

What to watch out for when converting between binary, octal, decimal and hexadecimal (prefixes, negatives, big integers), plus an introduction to the TwoThink base converter.

Reading memory dumps, tweaking colour values, decoding protocol fields — you constantly jump between bases 2 / 8 / 10 / 16. Doing it by hand is easy to get wrong, and a calculator is hard to paste into a document.

Common notations

  • Hexadecimal usually carries a 0x prefix, and colour values use #RRGGBB
  • Binary can be written 0b, and octal is occasionally written 0o
  • When pasting, strip spaces and thousands separators

The TwoThink base converter handles big numbers and negative values, and shows the result in every base as soon as you type on one side.

When not to use "any random online site"

If the string contains undisclosed key material or device serial numbers, do not paste it into a site of unknown provenance. The tools here compute everything locally in your browser, so nothing is uploaded.

How it splits up with hash and Base64