Guide
How to Convert Numbers Between Binary, Octal, Decimal and Hex
Understand number bases, how conversion works, and why hex and binary are everywhere in computing.
A number base converter translates a value between binary (base 2), octal (base 8), decimal (base 10), and hexadecimal (base 16). These bases underpin how computers represent and display numbers.
What number bases are
A base is the number of distinct digits used to represent values. Decimal uses 10 digits (0–9), binary uses 2 (0–1), octal uses 8 (0–7), and hex uses 16 (0–9 and A–F). The same quantity can be written in any base: decimal 255 is binary 11111111 and hex FF.
How conversion works
To convert from any base to decimal, multiply each digit by the base raised to its position and sum. To convert from decimal to another base, repeatedly divide by the target base and read the remainders upwards. Hex is a shorthand for binary: each hex digit maps to exactly 4 bits, which is why programmers use it to read binary compactly.
How to use the converter
- Enter a number and choose its base.
- Choose the target base.
- Read the converted value.
Examples
Decimal 42 = binary 101010 = octal 52 = hex 2A. Hex colour #FFFFFF is binary 111111111111111111111111 — three bytes of 255. The byte 0xAB is decimal 171.
When a number base converter is useful
- Reading or writing colour codes, memory addresses, or bitmasks.
- Learning or teaching computer science.
- Debugging values shown in hex in developer tools.
- Converting between bases for embedded systems work.
Put it into practice
Use the Number/Base Converter right now — free, in your browser, no sign-up required.
Try the Number/Base ConverterMore guides
- How to Unscramble Letters Into Words
- How to Find Anagrams of Any Word
- How to Count Words, Characters and Reading Time Accurately
- How to Find Words by Pattern, Length and Letters
- How to Use a Random Word Generator for Games, Writing and Brainstorming
- How to Count Characters (With and Without Spaces)
- How to Convert Text Between Cases (UPPER, lower, Title, camelCase and More)
- How to Clean Up Messy Text (Spaces, Line Breaks and Whitespace)
Related free tools
More free online utilities that pair well with this one — same-category tools for the same task, plus handy extras from other categories.
More converters tools
You might also need
- Base64 Encoder / DecoderConvert plain text or images to Base64 strings
- Base64 Image Encoder / DecoderConvert images to Base64 & Base64 back to images
- Case ConverterConvert text to upper, lower, title & more
- Color Picker & Hex ExtractorSample colors from an image as Hex & RGB
- Curl-to-Code ConverterConvert curl commands to fetch, Python & PHP