# Binary encoding visualised: nonnegative integers in n bits

> Interactive n-bit binary encoding: Horner conversion step by step, bit visualisation, value range, addition with carry and overflow.

Address: https://marckimmel.de/en/informatik/zahlenkodierungen/binaer
Deutsche Fassung: https://marckimmel.de/informatik/zahlenkodierungen/binaer.md

Stores nonnegative integers as binary numbers in n bits, padded with leading zeros.

Binary encoding c_(2,n) is the simplest n-bit encoding. It stores the binary representation of a number x with 0 <= x <= 2^n - 1, padded with leading zeros to length n. With n = 8 the representable range is 0 to 255. Addition is performed digit by digit with carry; a bit overflow is dropped via modulo 2^n.

In C this corresponds to the unsigned datatypes (unsigned char, unsigned int). Useful when negative values are excluded (indices, sizes, bit fields, low-level programming).

## Related

- [Number Encodings](https://marckimmel.de/en/informatik/zahlenkodierungen.md)
