Number Base Converter

Share:

Convert between binary, octal, decimal and hexadecimal instantly. Supports digit grouping, 8/16/32-bit padding, two's complement, and signed integers. Free, no signup.

RT-DEV-040 · Developer Tools

Number Base Converter Tool

Bit length:
Sample values:
🔵 Binary Base 2
🟠 Octal Base 8
🟢 Decimal Base 10
🔴 Hex Base 16

Negative value. Every base is showing sign-magnitude — a minus sign followed by the magnitude, so −13 is −1101 in binary, −15 in octal and −D in hex. Turn on Signed decimal above to see the two's complement bit pattern a CPU would actually store at the selected bit length.

Advertisement
After results · AD-W1 Responsive · Post-tool — peak engagement

How to Use the Number Base Converter

Type in any field

Enter a binary, octal, decimal or hex value into any of the four input fields — all other fields update instantly as you type. Binary accepts 0s and 1s; hex auto-capitalises to A–F.

Toggle digit grouping

Enable Group digits to format binary output in groups of 4 with spaces (e.g. 0101 1010) and hex in groups of 2, making long values much easier to read.

Select bit length

Choose 8, 16 or 32-bit to pad the binary output with leading zeros — useful when working with fixed-width registers, memory addresses, or protocol fields. A width you select is enforced: a value too large for it is rejected with the exact range, in whichever field you typed it, instead of silently overflowing into more bits than you asked for. Auto shows the minimum required bits.

Use the Copy button

Click the Copy button beside any field to send that value to your clipboard — ready to paste directly into your code, terminal, or documentation.

Advertisement
After how-to · AD-W2 Responsive

Number Systems in Computing — Why Computers Don't Think in Tens

Why Computers Think in Binary

At its most fundamental level, every computer is a collection of billions of tiny switches called transistors. Each transistor has exactly two states: on or off, conducting or not conducting, representing 1 or 0. This is why binary — the base-2 number system — is the native language of all digital electronics. Unlike humans who evolved with ten fingers and naturally count in base 10, electronic circuits are built around the simplest possible distinction: current flows, or it doesn't.

The mathematics underlying binary computation traces back to Gottfried Wilhelm Leibniz in the 17th century, who described a binary arithmetic system, and later to George Boole, whose Boolean algebra (AND, OR, NOT) gave engineers a formal language to describe logical circuits. By the mid-20th century, John von Neumann and his contemporaries formalised the stored-program computer — a machine where both instructions and data live in the same binary-encoded memory.

Eight bits grouped together form a byte, capable of holding 256 distinct values (0 to 255). This is why file sizes, memory capacities, and network speeds are measured in bytes, kilobytes, megabytes, and so on. Modern CPUs are 64-bit, meaning they process 64 binary digits at a time — allowing them to address over 18 quintillion individual memory locations in a single clock cycle.

The width of those groups is not a detail — it is a hard boundary you can compute. An n-bit unsigned field holds 0 to 2ⁿ − 1; the same field read as signed two's complement holds −2ⁿ⁻¹ to 2ⁿ⁻¹ − 1. For 8 bits that is 0–255 unsigned, or −128 to +127 signed. Every overflow bug ever shipped is a value that crossed one of those two lines. Select a bit length above and this converter will refuse a value that does not fit, rather than quietly printing more bits than you asked for.

Hexadecimal: The Programmer's Shorthand

Reading raw binary quickly becomes impractical. A 32-bit memory address in binary is 32 characters long — unwieldy to read, type, or verify. Hexadecimal (base 16) solves this elegantly: because 16 is exactly 2 to the power of 4, one hex digit maps perfectly onto four binary digits (a nibble). A 32-bit address shrinks from 32 binary digits to just 8 hex digits.

Programmers encounter hex constantly. RGB colour codes in CSS and design tools use hex: the RECATOOLS accent colour #E8622A encodes red=232 (0xE8), green=98 (0x62), blue=42 (0x2A). MAC addresses on your Wi-Fi adapter look like AA:BB:CC:DD:EE:FF — six pairs of hex bytes identifying your network interface. URL-encoded characters use hex: the space character becomes %20 because 0x20 is 32 in decimal, which is the ASCII code for space. When debugging at the byte level — reading memory dumps, packet captures, or binary file headers — hex is the universal language of low-level programming.

"Every image, video, document and website you've ever seen is ultimately stored as billions of 1s and 0s — binary is the language of all modern computing."

How Base Conversion Works Step by Step

Converting decimal to binary uses repeated division: divide the number by 2, record the remainder (0 or 1), divide the quotient by 2 again, and continue until the quotient is zero. Reading the remainders from bottom to top gives the binary representation. For example, 13 ÷ 2 = 6 R1, 6 ÷ 2 = 3 R0, 3 ÷ 2 = 1 R1, 1 ÷ 2 = 0 R1 → binary 1101.

Converting binary to decimal uses positional notation: each bit position carries a power of 2, with the rightmost bit representing 2⁰ = 1. So 11111111 = 128 + 64 + 32 + 16 + 8 + 4 + 2 + 1 = 255. Hex to binary is even simpler: each hex digit maps directly to a four-bit group (a nibble). F = 1111, A = 1010, so FA = 1111 1010 — no arithmetic required, just a lookup table.

Octal (base 8) was widely used in early Unix systems and remains relevant today: Unix file permissions are expressed in octal. The familiar chmod 755 means owner has rwx (4+2+1=7), group has r-x (4+0+1=5), others have r-x (5) — expressed in binary as 111 101 101. Each octal digit maps to exactly three binary digits, making octal a natural fit for permission triplets. IPv4 addresses like 192.168.1.1 are human-readable decimal representations of 32-bit binary numbers, where each of the four octets (0–255) corresponds to one byte of the address.

Negative numbers in binary use two's complement — the standard representation in virtually all modern CPUs. To negate a number: flip all bits, then add 1. For an 8-bit signed integer, the range is −128 to +127. The Year 2038 problem is the same arithmetic at 32 bits: the largest signed 32-bit value is 2³¹ − 1 = 2,147,483,647, and a counter of seconds that starts at 1970-01-01T00:00:00Z reaches that value at 2038-01-19T03:14:07Z. Work it out yourself — 2,147,483,647 seconds is about 68.05 years — and the famous date stops being folklore and becomes a division you can check.

10 Facts About Number Systems in Computing

01

Binary (base 2) is the foundation of all digital computing — modern CPUs process billions of binary operations per second using transistors as on/off switches.

02

A byte consists of 8 bits and can represent 256 different values (0–255) — the fundamental unit of digital storage and the basis for file sizes, memory, and network speeds.

03

Hexadecimal (base 16) uses letters A through F for values 10–15, making it perfectly aligned with 4-bit nibbles — one hex digit equals exactly four binary digits.

04

The octal system (base 8) was widely used in early computing — Unix file permissions still use octal today: chmod 777 means rwxrwxrwx (all permissions enabled).

05

IPv4 addresses like 192.168.1.1 are 32-bit binary numbers written in "dotted decimal" — each of the four segments represents one byte (0–255) of the binary address.

06

The RGB colour #FFFFFF is hexadecimal for red=255, green=255, blue=255 — pure white results when all three channels are at maximum 8-bit intensity simultaneously.

07

Two's complement lets computers represent negative numbers in binary — to negate a value, flip all bits then add 1. This system enables subtraction using addition circuits alone.

08

The maximum value of a 32-bit unsigned integer is 2³² − 1 = 4,294,967,295 — relevant to engineers dealing with system timestamps, game scores, network packet counters, and IPv4 address spaces.

09

Unicode, the standard encoding for all human languages including Chinese, Malay, and Tamil used in Singapore's multilingual digital systems, assigns code points written in hexadecimal.

10

The Year 2038 problem is pure arithmetic: a signed 32-bit counter tops out at 2³¹ − 1 = 2,147,483,647, which is 2,147,483,647 seconds — about 68.05 years — after 1970-01-01T00:00:00Z, landing on 2038-01-19T03:14:07Z.

Frequently Asked Questions

  • Type your decimal number into the Decimal (green) field and the binary result appears instantly. Manually, divide the number by 2 repeatedly and read the remainders from bottom to top: 13 ÷ 2 = 6 R1, 6 ÷ 2 = 3 R0, 3 ÷ 2 = 1 R1, 1 ÷ 2 = 0 R1 → binary 1101. Enable Group digits to format the result in groups of 4 for easy reading.
  • Hexadecimal (base 16) uses digits 0–9 and letters A–F (for values 10–15). Programmers prefer it because one hex digit maps exactly to 4 binary digits (a nibble), making large binary values far more compact. A 32-bit address that requires 32 binary digits needs only 8 hex digits. Hex appears everywhere in programming: memory addresses, RGB colours (#E8622A), MAC addresses, and URL encoding (%20 for space).
  • A byte is exactly 8 bits. This means one byte can hold 2⁸ = 256 different values (0 to 255). All digital storage — from SSD capacity to RAM size to network bandwidth — is measured in bytes or multiples thereof (kilobytes, megabytes, gigabytes). Select the 8-bit button in this converter to see binary output padded to exactly one byte.
  • Two's complement is the standard method for representing negative integers in binary. To negate a number: flip all its bits (one's complement), then add 1. For example, +5 in 8-bit binary is 00000101. Flip all bits: 11111010. Add 1: 11111011 = −5. This system lets CPUs subtract using the same addition circuits, and ensures only one representation of zero. Enter a negative number in this converter and, with Signed decimal off, every base shows sign-magnitude (−5−101); switch it on and binary, octal and hex all show the stored two's complement pattern instead (11111011, 373, FB at 8 bits).
  • Unix permissions have three groups (owner, group, others), each with three bits (read, write, execute) — totalling 9 bits. Since one octal digit represents exactly 3 binary digits, three octal digits perfectly encode all nine permission bits. chmod 755 means 7=111 (rwx), 5=101 (r-x), 5=101 (r-x) — the owner can read, write and execute; group and others can read and execute only.
  • A hex colour like #E8622A is three two-digit hex values: E8 = red, 62 = green, 2A = blue. Enter each pair into the Hex field of this converter to get the decimal values: E8 = 232, 62 = 98, 2A = 42. So #E8622A = RGB(232, 98, 42) — the RECATOOLS coral orange. For a full colour conversion including HSL and CMYK, try the RECATOOLS Color Converter.
  • A 32-bit unsigned integer can hold values from 0 to 4,294,967,295 (2³² − 1). A 32-bit signed integer (using two's complement) ranges from −2,147,483,648 to +2,147,483,647. Select 32-bit in this converter and enter 4294967295 to see it in all four bases. The signed limit is why Unix timestamps (stored as 32-bit signed integers) will overflow in 2038.
  • Unix systems count time as the number of seconds since 1 January 1970 (the Unix epoch), stored as a 32-bit signed integer. The maximum value of a 32-bit signed integer is 2³¹ − 1 = 2,147,483,647 — that many seconds is roughly 68.05 years, which lands on 03:14:07 UTC on 19 January 2038. After that moment, the counter overflows to a large negative number, potentially causing systems that haven't migrated to 64-bit timestamps to malfunction. This is directly analogous to the Y2K issue but in binary arithmetic.
  • This converter uses JavaScript's native BigInt type, which supports arbitrarily large integers with no precision loss — unlike standard floating-point numbers, which lose accuracy above 2⁵³. You can safely enter values well beyond 32-bit or 64-bit limits and receive exact conversions across all four bases. All conversions happen locally in your browser; no data is sent to any server.
  • Valid hexadecimal characters are the digits 0–9 and the letters A through F (or a–f in lowercase). This gives 16 possible values per digit position: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A (=10), B (=11), C (=12), D (=13), E (=14), F (=15). This converter auto-converts lowercase input to uppercase. The letters G–Z and any special characters are not valid hex and will trigger an error message showing which character is invalid.

Related News

You may be interested in these recent stories from our newsroom.

View all news →
Advertisement
Pre-footer · AD-W3 728 × 90