Hex Calculator
Convert between hexadecimal, decimal, binary, and octal. Perform arithmetic on hex numbers.
Convert hexadecimal values to and from decimal, binary, and octal, run basic arithmetic and bitwise operations on hex numbers, and preview hex color codes.
How Hex Calculator Works
The converter reads your input using whichever base you've selected, parses it into a plain decimal integer, and then re-expresses that same value in hex, binary, and octal — plus, if the decimal value falls in the printable ASCII range (32–126), it shows the corresponding text character.
Arithmetic mode parses both numbers you enter as base-16 integers and applies your chosen operator — either plain arithmetic (+, −, ×, ÷) or a bitwise operation (AND, OR, XOR) — then redisplays the result back in hexadecimal, along with its decimal, binary, and octal equivalents.
When the hex value being converted is exactly 3 or 6 digits long, the calculator also renders it as a color swatch, since those are the two standard lengths for web CSS colors: #RGB (3 digits) and #RRGGBB (6 digits).
See It In Action
Who Uses Hex Calculator and Why
- Looking up or previewing a CSS color code from its hex value during web development.
- Converting a memory address or debugger output between hex, binary, and decimal.
- Decoding an ASCII character from a hex value using the built-in character lookup.
- Running a bitwise AND, OR, or XOR operation directly on two hexadecimal numbers.
Mistakes to Avoid
- Expecting a color swatch to appear for a hex value that isn't exactly 3 or 6 digits long — those are the only two lengths that match the standard #RGB and #RRGGBB CSS formats.
- Expecting an ASCII character to display for a decimal value outside the printable range of 32–126 — the field only fills in within that range.
- Confusing this tool's hex-first arithmetic and bitwise operations with plain decimal math, forgetting the entered numbers are parsed as base-16.
Tips for Best Results
- Use the ASCII Char field as a fast way to decode what character a given hex or decimal byte value represents.
- If you need a color preview, double check your hex string is exactly 3 or 6 digits — anything else won't trigger the swatch.
Fixing Common Problems
No color swatch is showing for my hex value. — Color previews only appear for hex values exactly 3 or 6 digits long, matching the standard #RGB or #RRGGBB CSS formats — any other length won't render a swatch.
Terms Explained
ASCII: A standard character encoding that maps numeric values (32–126 for printable characters) to letters, digits, and symbols.
RGB hex code: A 3- or 6-digit hexadecimal color format (like #F00 or #FF0000) used throughout CSS and design tools.