UtilityKit

500+ fast, free tools. Most run in your browser only; Image & PDF tools upload files to the backend when you run them.

Base Converter

Convert integers between binary, octal, decimal, and hexadecimal.

About Base Converter

Programmers, embedded engineers, network administrators, and computer science students constantly work with numbers expressed in binary (base 2), octal (base 8), decimal (base 10), and hexadecimal (base 16). Manually converting between these bases is error-prone and slow — especially for large values or when two's complement representation matters for signed integers. This base converter shows all four standard representations simultaneously as you type in any one of them. Binary output is formatted in 4-bit nibble groups (for example, 1111 1111) because each nibble maps directly to one hexadecimal digit, making the relationship visually immediate. Signed two's complement view for 8-bit, 16-bit, and 32-bit widths lets you see how negative integers are stored in memory — essential for debugging overflow bugs.

Why use Base Converter

All Four Bases at Once

Type in binary, octal, decimal, or hex and all other representations update simultaneously. No sequential conversion steps — all four answers are visible in one view the moment you finish typing.

Custom Bases from 2 to 36

Beyond the four standard bases, enter any radix from 2 to 36. Base 36 (using digits 0–9 and letters A–Z) is used in URL shorteners, identifier systems, and some legacy encodings.

Nibble-grouped Binary Display

Binary output is spaced in 4-bit groups, making it immediately clear which hex digit each nibble corresponds to. This is the standard display format used in datasheets, memory dumps, and register maps.

Two's Complement for Signed Integers

Toggle 8-bit, 16-bit, or 32-bit signed mode to see how negative values are represented in memory. Essential for debugging signed-integer overflow, bit manipulation, and hardware register interpretation.

Copy with Language Prefixes

Copy button outputs values with standard language prefixes (0b for binary in Python/JS, 0x for hex in C/Java/Python) or without them for plain numeric use. One option for all major languages.

Fully Offline

All conversion logic is pure JavaScript with no external dependencies beyond the page load. Works without an internet connection once cached — useful in offline development environments and air-gapped labs.

How to use Base Converter

  1. Type a number in any of the four base fields — binary, octal, decimal, or hexadecimal — or in the custom base field
  2. Watch all other base representations update instantly as you type each digit
  3. Optionally include a language prefix when entering input (0b, 0o, 0x) — the tool strips these automatically
  4. Toggle the bit-width selector (8, 16, or 32 bits) to switch between unsigned and signed two's complement views
  5. Click the copy button on any field to copy the value, optionally with its language prefix
  6. Use the custom base field to convert to or from any base between 2 and 36

When to use Base Converter

  • When reading a hardware datasheet or memory map that specifies register values in hexadecimal and you need the binary bit-pattern to check individual flags
  • When debugging a bit-manipulation bug and you need to see the two's complement binary representation of a negative integer
  • When a Unix chmod permission value is given in octal (such as 755) and you want to verify the exact read-write-execute bit pattern
  • When a CSS colour value is in hexadecimal (#FF5733) and you want to know the decimal red, green, and blue component values
  • When a computer science assignment asks you to convert decimal to binary by hand and you want to verify your work
  • When working with a URL shortener or identifier system that uses base 36 encoding and you need to decode or encode a value

Examples

Decimal 255 to all bases

Input: 255 (decimal)

Output: Binary: 1111 1111 — Octal: 377 — Hexadecimal: FF

Hex to decimal and binary

Input: 0xCAFE (hexadecimal)

Output: Decimal: 51,966 — Binary: 1100 1010 1111 1110

Two's complement — negative one

Input: -1 in 8-bit signed two's complement

Output: Binary: 1111 1111 — Hex: FF — Decimal unsigned interpretation: 255

Tips

  • Group binary numbers in 4-bit nibbles mentally — each nibble maps to exactly one hex digit, making binary-to-hex conversion a visual pattern match
  • Hex pairs map to bytes perfectly — a 4-byte (32-bit) value is exactly 8 hex characters. This makes hex ideal for reading memory dumps and network packet captures
  • Enable two's complement signed view when debugging signed-integer overflow — the same bit pattern reads as a large positive unsigned value or a negative signed value depending on interpretation
  • Octal is mostly a historical artefact in modern programming but is still used in Unix/Linux file permission modes: chmod 755 means owner read-write-execute, group read-execute, other read-execute
  • The 0b, 0o, and 0x prefixes work in Python 3, JavaScript ES6+, and most modern C/C++ compilers — using them makes integer literals self-documenting in source code

Frequently Asked Questions

What does the 0x prefix mean?
The 0x prefix is a widely adopted convention in programming languages including C, C++, Java, Python, and JavaScript to indicate that the following number is in hexadecimal (base 16). For example, 0xFF means 255 in decimal. The prefix is not part of the value itself — it is purely a notation marker.
Why use hexadecimal instead of binary?
Binary numbers for large values are very long and hard to read. Each hex digit represents exactly four binary bits (a nibble), so a 32-bit number that is 32 binary digits long becomes just 8 hex digits. This makes memory addresses, colour codes, and register values far more compact and readable without losing precision.
How does two's complement represent negative numbers?
In two's complement, negative numbers are represented by inverting all bits of the positive value and then adding 1. For example, +1 in 8-bit binary is 00000001; −1 is 11111110 + 1 = 11111111 (0xFF in hex). The most significant bit serves as the sign bit: 0 means positive, 1 means negative.
What is the maximum value of an 8-bit, 16-bit, 32-bit integer?
For unsigned integers: 8-bit max is 255 (0xFF), 16-bit is 65,535 (0xFFFF), 32-bit is 4,294,967,295 (0xFFFFFFFF). For signed two's complement: 8-bit ranges from −128 to +127, 16-bit from −32,768 to +32,767, and 32-bit from −2,147,483,648 to +2,147,483,647.
What is the difference between octal and hexadecimal?
Octal (base 8) uses digits 0–7 and groups three binary bits per digit. It was historically common in older computing architectures and remains visible in Unix file permissions. Hexadecimal (base 16) uses digits 0–9 and A–F, grouping four binary bits per digit, and is far more prevalent in modern computing.
How do I convert binary to hex by hand?
Group the binary number into 4-bit nibbles from right to left, padding with leading zeros if needed. Then convert each nibble to its hex equivalent: 0000=0, 0001=1, ..., 1010=A, 1011=B, 1100=C, 1101=D, 1110=E, 1111=F. For example, 11001010 = 1100 1010 = C A = 0xCA.
Can I convert fractions to other bases?
This tool converts integers only. Fractional base conversion is a more complex process involving repeated multiplication, and results can be non-terminating in many bases. For example, 0.1 in decimal is a repeating fraction in binary (0.0001100110011...). Integer-only conversion covers the vast majority of programming and hardware use cases.
What base do MAC addresses and colours use?
Both use hexadecimal (base 16). A MAC address like 00:1A:2B:3C:4D:5E has six pairs of hex digits representing six bytes. CSS and HTML colour codes like #FF5733 have three hex pairs representing red (FF=255), green (57=87), and blue (33=51) components as 0–255 values.

Explore the category

Glossary

Binary (Base 2)
A number system that uses only the digits 0 and 1. Every value is expressed as a sum of powers of 2. Binary is the native representation of digital logic because transistors have two states: on (1) and off (0).
Octal (Base 8)
A number system using digits 0–7. Each octal digit represents exactly three binary bits. Octal appears mainly in Unix file permission modes (chmod) and some older computing contexts.
Decimal (Base 10)
The standard everyday number system using digits 0–9. Each digit position represents a power of 10. Humans use decimal because we have ten fingers; computers use binary internally but often display results in decimal for readability.
Hexadecimal (Base 16)
A number system using digits 0–9 and letters A–F, where A=10 and F=15. Each hex digit represents exactly four binary bits (one nibble). Hexadecimal is the standard notation for memory addresses, colour codes, and machine-level values in computing.
Two's Complement
The most common method for representing signed (positive and negative) integers in binary. A negative number is obtained by inverting all bits of the positive representation and adding 1. The most significant bit acts as the sign bit.
Bit / Byte / Nibble
A bit is the smallest unit of binary data (0 or 1). A nibble is 4 bits, which maps to one hexadecimal digit. A byte is 8 bits (two nibbles), capable of representing 256 distinct values (0–255 unsigned).