Skip to main content
riqo.ioTools for big ideas

Number base converter

Convert signed integers between bases 2, 8, 10 and 16 with canonical output.

Source base
Target base

Note

Supports signed integers in bases 2, 8, 10 and 16.

Result

Description

Converts integer values between binary, octal, decimal and hexadecimal. V1 does not handle floating point, automatic prefixes or arbitrary bases.

Instructions

Enter the value and select source and target bases. The value must be valid for the selected source base and within the runtime signed-integer limit.

Use cases

Convert binary to hexadecimal

Read octal values

Compare integer representations

Examples

Decimal → hexadecimal

Input

255

Output

ff

Frequently asked questions

Are 0x or 0b prefixes detected automatically?

No. The base is selected explicitly and output has no prefix.

Does it support fractional values?

No. V1 supports signed integers only.

In-depth guide

Number systems: binary, octal, decimal and hexadecimal

Positional bases, conversion, computer representations and the difference between mathematical value and bit interpretation.

The positional notation principle

In base b, each digit is a coefficient multiplied by a power of b. Decimal 347 means 3×10² + 4×10¹ + 7, and the same rule defines binary, octal and hexadecimal notation.

Changing the base does not change the mathematical value, only its representation. 0xFF, 255 and 11111111₂ can therefore denote the same integer.

Binary, octal and hexadecimal

Binary uses two digits and maps naturally to bit states. Octal groups bits in threes, while hexadecimal groups them in fours and uses A-F for values ten through fifteen.

Hexadecimal is compact for bytes, addresses, masks and dumps because one byte is exactly two hex digits. Octal remains useful in specific Unix conventions such as permission notation.

Converting without changing meaning

To convert from a base to decimal, sum each digit's positional contribution. To convert a non-negative decimal integer to another base, repeated division or powers can be used depending on whether the calculation is manual or implemented.

Binary and hexadecimal convert directly by grouping four bits. Leading zeroes do not change an integer's value, but they may be significant when a representation has fixed width.

Sign and two's complement

A minus sign is a mathematical notation, while a fixed-width bit pattern may be interpreted as unsigned or signed. Modern systems overwhelmingly use two's complement for signed integers.

The bit pattern 11111111 is 255 as an unsigned 8-bit value and -1 as signed two's complement. Width and interpretation are therefore required to map a bit pattern to a signed number.

Overflow and fixed width

An n-bit integer can represent only a finite range. Hardware operations often retain the lowest n bits, producing unsigned wrap-around or language-specific behavior for signed overflow.

Registers, protocols and binary files require knowledge of width, signedness and endianness. The base used to print the number does not determine any of these properties.

Practical uses and best practices

Binary is useful for masks and flags; hexadecimal makes bytes and addresses readable; octal serves specific conventions; decimal remains natural for human-facing quantities.

Use unambiguous prefixes or labels, preserve meaningful leading zeroes where width matters and keep the numerical value separate from the semantic interpretation of the field.

Open the full guide