Number Base Converter
Convert numbers between binary, decimal, hexadecimal and octal
Referencia de bases numéricas
Dígitos: 0-1
Dígitos: 0-7
Dígitos: 0-9
Dígitos: 0-9, A-F
Online Number Base Converter - Binary, Decimal, Hexadecimal
Why do programmers need different number systems?
Computers work natively in binary (base 2) because their circuits only distinguish two states: on and off, 1 and 0. Hexadecimal (base 16) is popular because each hex digit represents exactly 4 bits, which makes long binary values easy to read and convert. It shows up in CSS colors (#FF5733), memory addresses, Unicode character codes and low-level debugging. Octal (base 8) appears in Unix permissions such as chmod 755. Understanding these bases is fundamental for debugging, optimization and working with low-level APIs.
How do conversions between bases work?
Every position in a number carries a value based on powers of the base. In decimal (base 10), 255 = 2x10^2 + 5x10^1 + 5x10^0. In binary (base 2) the same value is 11111111 = 1x2^7 + 1x2^6 + ... + 1x2^0. In hexadecimal (base 16) it is FF = 15x16^1 + 15x16^0, since F equals 15. To convert by hand you first move to decimal by dividing repeatedly by the source base, then to the target base by multiplying out. This tool automates the process, but knowing the algorithm helps in technical interviews and during debugging.
When should you use each number system in programming?
Use decimal for ordinary maths and for anything users see in the UI. Use hexadecimal for colors (#RRGGBB), memory addresses (0x7FFF), individual bytes while debugging, and code literals when you work with bits. Use binary for bitwise operations such as flags, masks and protocols, for understanding data representation, and for low-level optimization. Use octal for Unix and Linux file permissions (chmod 644) and a few legacy data formats. Code prefixes help you keep track: 0x for hex, 0b for binary and 0o for octal.
If you work with this tool, you will probably also find these useful Color Converter, Timestamp Converter, Base64 Encoder, URL Encoder.
Frequently asked questions
Why do CSS colors use hexadecimal?
RGB colors have three components, red, green and blue, each ranging from 0 to 255, which is exactly one byte of 8 bits. Two hexadecimal digits represent one byte perfectly, from 00 to FF. That makes #FF5733 readable: FF (255) of red, 57 (87) of green and 33 (51) of blue. It is more compact than rgb(255,87,51) and easy to manipulate mentally once you remember that F is 15 and A is 10. A converter like this one helps whenever you need to compute colors programmatically.
How are negative numbers represented in binary?
Computers use two-complement representation for negative numbers. The most significant bit carries the sign, 0 for positive and 1 for negative. To negate a number you invert every bit and add 1. In 8 bits, 5 is 00000101 and -5 is 11111011: invert to get 11111010, then add 1. That scheme lets addition and subtraction work identically regardless of sign. This tool works with positive integers, so for negatives in your own code keep your language representation in mind.
What is the largest number I can convert?
This tool uses standard JavaScript arithmetic, which represents integers exactly up to 2^53-1, or 9,007,199,254,740,991. Beyond that JavaScript loses precision, and in binary that limit is a 53-digit number. If you work with 256-bit cryptographic hashes or very long identifiers you will need arbitrary precision support such as BigInt in modern JavaScript. For most practical uses, colors, permissions and addresses, the standard range is more than enough.