Calculators & Utilities

Hex CalculatorConvert Hex, Decimal, Binary and Octal

Converts numbers between hexadecimal, decimal, octal and binary.

Hex Calculator tool

Enter your numbers

Input base

Whole, non-negative numbers. A 0x, 0o or 0b prefix is fine. Switching the base clears the box.

Try an example

Convert between four bases

Pick the base you are typing in, enter a number, then press Convert.

About the Hex Calculator

The hex number FF equals 255 in decimal, 11111111 in binary, and 377 in octal. Kwebby's Hex Calculator shows all four forms of a number side by side, so you never have to convert by hand. The page has one field each for DEC, HEX, OCT, and BIN. Enter a value in any base and read it in the other three.

Key Takeaways

  • Kwebby's Hex Calculator converts numbers between hexadecimal, decimal, octal, and binary, with a field for each base.
  • Hexadecimal is base 16. It uses the digits 0 to 9 and the letters A to F, where A is 10 and F is 15.
  • One hex digit equals exactly four binary digits, and two hex digits equal one byte. That is why FF is the largest value a byte can hold.
  • Hex appears in CSS color codes, memory addresses, MAC addresses, and cryptographic hashes.
  • To check hand arithmetic in hex, convert each number to decimal, do the math, and convert the answer back.
  • The tool is free and needs no account.

What Is the Kwebby Hex Calculator?

Kwebby's Hex Calculator is a free multi-base converter for programmers, students, and engineers. It takes a number in decimal, hexadecimal, octal, or binary and shows the same number in the other bases. The page describes the conversion as instant.

Wikipedia defines hexadecimal as a positional numeral system for representing a numeric value as base 16. The system needs 16 symbols, so it borrows six letters after 9. The letters A, B, C, D, E, and F stand for 10, 11, 12, 13, 14, and 15.

Key Features and How It Works

One Input, Four Results

Four buttons, DEC, HEX, OCT and BIN, set the base of the number you type. Switching the base clears the input. As you type, the tool lists the value in decimal, hexadecimal (with a 0x prefix), octal (with a 0o prefix) and binary, each with a copy link. It accepts whole, non-negative numbers of any length, lowercase or uppercase hex letters, and an optional 0x, 0o or 0b prefix. A character that is not a digit of the selected base shows an error instead of a partial result. The tool converts; it has no add or subtract buttons.

Examples You Can Try

Type these values to see how the bases line up:

Hex Decimal Binary Octal
1A 26 11010 32
FF 255 11111111 377
2AA 682 1010101010 1252
1A3F 6719 1101000111111 15077

Free and Simple

The page states that the tool is free and that no account is needed. A "Report if not working" button is on the page if a conversion looks wrong.

Why Hexadecimal Matters

Hex exists because binary is accurate but long. Wikipedia notes that one hex digit represents four bits, called a nibble, and two hex digits make one 8-bit byte. A 32-bit value that takes 32 binary digits to write needs only 8 hex digits.

The Kwebby page lists the places where programmers meet hex every day:

  • CSS colors. A web color is written as #RRGGBB, with one hex pair each for red, green, and blue. #FF0000 is pure red, #000000 is black, and #FFFFFF is white.
  • Memory addresses. Debuggers and assembly code show addresses in hex. The address 0x1A3F is shorter than 6719 in decimal.
  • MAC addresses. Network hardware addresses are six hex bytes, such as 00:1A:2B:3C:4D:5E.
  • Cryptographic hashes. A SHA-256 hash is shown as 64 hex characters, which stand for 256 bits.

In many programming languages, the prefix 0x marks a number as hex. Wikipedia gives 0x1EB, which equals 491 in decimal, as an example.

The top-ranking hex calculators take different routes. RapidTables offers arithmetic and bitwise operators with no explanation of the rules, and Calculator.net covers the four arithmetic operations but leaves out bitwise logic. Kwebby pairs a four-way converter with the rules, so you can see why 2AA becomes 682 as well as what the answer is.

How to Use the Hex Calculator

Follow these steps.

  1. Pick the base of your number. Click DEC for decimal, HEX for hexadecimal, OCT for octal, or BIN for binary.
  2. Type your number. Use only digits that belong to that base. Hex accepts 0 to 9 and A to F, octal accepts 0 to 7, and binary accepts 0 and 1.
  3. Read the results. The page shows the same value in all four bases.
  4. Copy the form you need. Click copy next to a row, then paste the hex value into your code, the binary value into your notes, or the decimal value into a spreadsheet.

If a conversion looks wrong, use the "Report if not working" button on the page.

Best Practices for Hex Math

Convert Hex to Decimal by Hand

Multiply each digit by 16 raised to its position, counting from 0 on the right, then add the results. For 1A, that is (1 × 16) + (10 × 1) = 26. For 2AA, it is (2 × 256) + (10 × 16) + (10 × 1) = 682.

Convert Decimal to Hex by Dividing

Divide by 16 and keep each remainder. To convert 1500, divide by 16 to get 93 remainder 12 (C), then 93 by 16 to get 5 remainder 13 (D), then 5. Read the remainders from the last to the first: 5DC.

Add Hex Numbers Column by Column

Carry when a column reaches 16, not 10. In 2F + 1B, F + B is 15 + 11 = 26, which is 1A in hex, so write A and carry 1. Then 2 + 1 + 1 gives 4. The answer is 4A, and the decimal check agrees: 47 + 27 = 74.

Check Hand Math With the Converter

To verify any hex arithmetic, convert both numbers to decimal, do the math there, and convert the result back. For A3 minus 5C, that is 163 minus 92, which is 71. Select DEC and type 71, and the Hexadecimal row should read 0x47.

Common mistakes to avoid:

  • Mixing up the letter O and the digit 0.
  • Carrying at 10 instead of 16 in hex addition.
  • Forgetting that the digits above 9 are letters.
  • Reading a hex number such as 100 as one hundred. In hex, 100 equals 256.

Common Use Cases

Web Design

Convert a color channel from decimal to hex when a design tool shows RGB numbers. Red 255 is FF, and 128 is 80. Use the Color Picker to choose and convert the whole color.

Programming and Debugging

Read memory addresses, register values, and byte dumps in the form your tools show, then convert to decimal or binary to understand them.

Networking

Read MAC addresses and IPv6 addresses, which are written in hex.

Security and Hashing

Hash functions output hex strings. The MD5 and Hash Generator produces hashes, and the hex output is easier to read once you know that each character is four bits.

Learning Number Systems

Compare the four bases for the same number. Doing so shows that the base changes the notation but not the value.

The Hex Calculator is part of Kwebby's Calculators and Utilities collection. These tools work well with it:

Final Thoughts

Hexadecimal is binary in a shorter form, and once you know the digits A to F, it reads quickly. Kwebby's Hex Calculator gives you the decimal, hex, octal, and binary form of a number in one place. Try the examples above, then use the converter to check your own hand math. For more number tools, browse the Calculators and Utilities collection.

FAQ

Frequently asked questions

What is hexadecimal?

Hexadecimal is a base-16 number system that uses the digits 0 to 9 and the letters A to F. Each hex digit equals four binary bits, which makes hex a compact way to write binary data.

How do you convert hex to decimal?

Multiply each hex digit by 16 raised to its position, starting at 0 on the right, and add the results. For example, 1A is (1 × 16) + (10 × 1), which equals 26.

How do you convert decimal to hex?

Divide the number by 16 repeatedly and note each remainder. Then read the remainders from last to first, writing 10 to 15 as A to F. For 1500, the result is 5DC.

How do you add hex numbers?

Add column by column and carry when a column reaches 16. For example, 2F + 1B equals 4A, because F + B is 26, which is 1A in hex.

Where is hexadecimal used?

Hex is used in CSS color codes, memory addresses, MAC addresses, cryptographic hashes, and assembly code. It is popular because it shortens long binary strings.

Is the hex calculator free?

Yes. The tool is free and needs no account.

Kwebby builds software too

Need a website or app built?

Get 50% off your first project. The discount applies to your first fixed quote only. Kwebby has delivered 1,200+ projects on fixed quotes from $100.

Step 1 of 3 · What do you need?

Get a fixed quote

50% off your first project. Applies to your first fixed quote only.

What do you need?

Pick an option to see its starting price and typical timeline.