🌐 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.
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
| Base | Name | Digits | Where it appears |
|---|---|---|---|
| 2 | Binary | 0-1 | Hardware, bitmasks |
| 8 | Octal | 0-7 | File permissions |
| 10 | Decimal | 0-9 | Everyday arithmetic |
| 16 | Hexadecimal | 0-9, A-F | Colours, 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 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)
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.
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.
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.
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.