Subcategory Hub

🌐 Number Encoding

Every number a computer stores is binary; every system of showing it - decimal, hex, octal, ASCII, UTF-8 - is a translation layer. These tools convert between the layers and show the bit patterns behind them.

💻 Dev

Binary Converter (Binary, Decimal, Hex & Octal)

Live-synced binary, decimal, hexadecimal, and octal fields with bit-length, byte grouping, ASCII, and signed two's complement views for 8- and 16-bit values.

Open Calculator →

Number Systems and Character Encoding: The Layer Beneath the Text

A file does not contain letters or numbers in the way a screen shows them. It contains bits, grouped into bytes, interpreted by a convention. Most data corruption and half the confusion in programming come from mixing up which convention applies.

1. The four number bases you will meet

BaseNameDigitsWhere it appears
2Binary0-1Hardware, bitmasks
8Octal0-7File permissions
10Decimal0-9Everyday arithmetic
16Hexadecimal0-9, A-FColours, memory addresses, hashes

Hexadecimal is compact because each digit maps to exactly four bits, so one byte becomes two hex digits. That is why colours are written as six hex characters and why hashes look the way they do. Convert between bases with the Binary Converter.

2. ASCII and UTF-8 are not the same thing

ASCII: 1 byte, 128 code points   UTF-8: 1-4 bytes, over 1.1 million code points

ASCII covers English letters, digits and basic punctuation in seven bits. UTF-8 is a superset that encodes the same ASCII values in one byte but can extend to four bytes for other scripts, emoji and symbols. A file saved as ASCII and then given a character outside its range will show garbage - the classic mojibake.

3. Bits, bytes and precision

Eight bits make a byte, and a value's range depends on how many bits are allocated: 8 unsigned bits hold 0 to 255, 16 bits hold 0 to 65,535, and signed variants halve the positive range to allow negatives. Storage and memory sizes use the same binary multiples, so 1 GB is 1,024 MB rather than 1,000.

4. Where encoding errors actually show up

Broken text usually appears at three seams: a database with the wrong collation, a CSV opened in a spreadsheet that guesses the charset, or an HTTP response without a charset declaration. Fix the declaration rather than re-typing the text. For data volumes and storage planning, see the Data Usage Hub, or browse the Network and Tech Calculators directory.

Frequently Asked Questions (Number Encoding)

What is the difference between ASCII and UTF-8?

ASCII defines 128 code points in a single byte, covering English characters and basic symbols. UTF-8 is a superset that uses the same single-byte values for ASCII but extends to four bytes for other scripts, emoji and symbols.

Why is hexadecimal used for colours and memory addresses?

Because one hex digit represents exactly four bits, so a byte is two digits and the mapping is visually compact. That makes byte boundaries easy to read, unlike decimal, where bit boundaries do not align with digits.

How many values fit in one byte?

An unsigned byte holds 0 to 255, or 256 values. A signed byte uses one bit for the sign and holds -128 to 127, which is why overflow behaviour differs between signed and unsigned types.

Why does my text show strange characters?

Almost always a charset mismatch: the bytes were written in one encoding such as UTF-8 but read as another such as Windows-1252. Correcting the declared encoding, not re-typing the text, restores the original characters.