Number Systems

Radix Converter

Convert integer values from any base 2 through 36 into binary, octal, decimal, hexadecimal, and base 36.

Base 2

11111111

Base 8

377

Base 10

255

Base 16

FF

Base 36

73

Radix Conversion Across Number Bases

A radix, or base, defines how many digit symbols a number system uses before carrying to the next position. Decimal is base 10, binary is base 2, octal is base 8, and hexadecimal is base 16. In software and digital hardware, engineers often need to move between these forms because each base reveals different information. Binary shows individual bits, hexadecimal compresses binary into readable nibbles, decimal is convenient for human quantities, and larger bases can represent compact identifiers.

Place value works the same in every base. The rightmost digit represents base^0, the next digit represents base^1, then base^2, and so on. The value 1011 in base 2 equals 1×8 + 0×4 + 1×2 + 1×1, or decimal 11. The value FF in base 16 equals 15×16 + 15, or decimal 255. Understanding that structure makes conversions predictable instead of mysterious.

Manual Conversion

To convert from another base to decimal, multiply each digit by its positional weight and sum the results. To convert from decimal to another base, repeatedly divide by the target base and record the remainders. The remainders, read in reverse order, form the converted value. This division method is the same whether the target base is 2, 8, 16, or 36.

Why Base 36 Exists

Bases above 10 use letters as digit symbols. Base 16 uses A through F. Base 36 uses digits 0 through 9 and letters A through Z. It is useful for compact human-readable identifiers, short codes, and internal tools where a value needs to be smaller than decimal text but still easy to copy. It is not usually used for low-level bit inspection because it does not align neatly with powers of two.

Embedded Applications

Firmware engineers use radix conversion when reading registers, masks, addresses, bootloader commands, packet fields, and diagnostic logs. A GPIO register may be easiest to inspect in binary, but its address is usually written in hexadecimal. A test report may list a count in decimal. A good converter lets the engineer paste one representation and immediately inspect the others.

Input Validation

Every base has a limited digit set. The digit 9 is invalid in octal, and the letter G is invalid in hexadecimal. A converter should reject invalid digits because silently accepting them would hide mistakes. This is especially important when copying values from logs or documentation where separators, prefixes, or formatting may not match the expected base.

Engineering Judgment

Conversion does not change the underlying value; it changes the view. The best base depends on the task. Use binary for bit-level logic, hexadecimal for bytes and words, decimal for measurements and counts, and base 36 for compact labels. Clear radix notation prevents expensive misunderstandings, especially in mixed hardware and software teams.

Prefixes and formatting conventions help avoid ambiguity. Many languages use 0x for hexadecimal and 0b for binary, while older systems sometimes use a leading zero for octal. Documentation should state the base explicitly when values could be confused. A mask written as 1000 means very different things in base 2, base 10, and base 16. A converter is useful, but clear notation is the better long-term defense.

For fixed-width machine values, preserve leading zeros when the width matters. The value 0x000F and 0xF are numerically identical, but the first form communicates a 16-bit field while the second does not. Register maps, packet examples, and bit masks should include enough digits to show the intended width. Numeric conversion and field formatting are related but not identical tasks.

Signed interpretation is separate as well. A converted hexadecimal value may represent an unsigned integer, two-complement signed integer, packed BCD value, or bit field. The radix conversion gives the raw magnitude. Data-sheet context determines whether the high bit is a sign bit, a flag, or simply part of an unsigned value.

For user interfaces, show both the converted value and the assumed input base. That prevents a copied value from losing its context when it moves into a bug report or design note.