Number Base Converter
Convert between decimal, binary, hexadecimal, and octal. Enter a non-negative integer in the selected base and get the result in the other base. Pick a base on the left and one on the right.
Convert non-negative integers between decimal, binary, hexadecimal, and octal. Select the From base in the left table and the To base in the right table, enter the value in the selected base, and copy the result. The input must be a valid number in the chosen base (e.g. only 0 and 1 for binary, 0–9 and A–F for hex).
Loading…
Examples
- 255 (decimal) → FF (hex)
- 255 (decimal) → 11111111 (binary)
- FF (hex) → 255 (decimal)
FAQ
What is hexadecimal?
Hexadecimal (base 16) uses digits 0–9 and A–F. It is often used in computing (e.g. for colors or memory addresses).
What is octal?
Octal (base 8) uses digits 0–7. It is less common today but still used in some computing contexts.
Can I convert negative numbers?
This tool accepts only non-negative integers. For negative or fractional values you would need a different approach.
Why do computers use binary?
Binary (base 2) maps directly to the two physical states of electronic circuits: off (0) and on (1). All data a computer processes — numbers, text, images — is ultimately stored and manipulated as sequences of 0s and 1s.
Where is hexadecimal used in web development?
Hex is used for CSS colors (#ff5733), HTML character references, HTTP encoding, and crypto hashes. A six-digit hex color is three pairs: RR GG BB in base 16.
How do I add two binary numbers?
Add column by column from right to left, carrying when the sum exceeds 1. Example: 0101 + 0011 = 1000 (5 + 3 = 8). Convert both to decimal first if you only need the result.
What is the largest value that fits in one byte?
A byte is 8 binary digits, so the maximum unsigned value is 11111111 in binary = FF in hex = 255 in decimal.
Why do programmers count from 0?
Arrays in most languages are zero-indexed because memory addresses start at offset 0. Binary naturally represents 0 to (2ⁿ − 1) for n-bit values, making zero-based counting efficient.
What is the difference between hex and base-64?
Hex uses 16 symbols (0–9 A–F), encoding each byte as two characters. Base-64 uses 64 symbols (A–Z a–z 0–9 +/), encoding every 3 bytes as 4 characters — more compact but not the same as a number base.
How do I read a hex color code like #3a9fbf?
Split it into three byte pairs: 3A (red) = 58 decimal, 9F (green) = 159 decimal, BF (blue) = 191 decimal. That gives rgb(58, 159, 191), a medium cyan-blue.
What are signed vs unsigned integers?
Unsigned integers use all bits for magnitude (0 to 2ⁿ−1). Signed integers reserve the top bit for sign, giving a range of −2ⁿ⁻¹ to 2ⁿ⁻¹−1. For example, an unsigned 8-bit integer goes 0–255, while signed 8-bit goes −128–127.
How are IP addresses related to hex?
IPv4 addresses like 192.168.1.1 can be written as hex: C0.A8.01.01. IPv6 addresses are always written in hex groups (e.g. 2001:0db8:85a3::1). Converting to decimal or hex is a common networking task.
What does 0x mean before a number?
The 0x prefix is a convention in C, Python, JavaScript, and many languages to denote a hexadecimal literal. For example, 0xFF equals 255 in decimal.