Skip to main content
RT
RoughTools.com
free online toolsNo signup required
🔢

Free Hex Calculator

Convert hexadecimal to decimal, binary, RGB, and HSL. Perform hex arithmetic and decode CSS color codes. Free, private — all calculations run in your browser.

⚡ Instant results🔒 100% private🆓 Always free🚫 No signup🎨 Color preview
Hexadecimal
0xFF
Decimal
255
Octal
0o377
Binary
0b11111111
Bit Representations
8-bit11111111
16-bit0000000011111111
32-bit00000000000000000000000011111111
Common Hex Values

About This Hex Calculator

The Hex Calculator converts hexadecimal numbers to and from decimal, binary, and octal, performs arithmetic on hex values, and decodes CSS hex color codes into RGB and HSL components with a live color preview. It is designed for web developers, software engineers, computer science students, and anyone who works with color systems, memory addresses, or low-level binary data.

The Formula — How Hex Conversion Works

Hexadecimal (base-16) uses positional notation. Each digit is multiplied by 16 raised to its position (from right at 0):

Decimal = d₍ₙ₎ × 16ⁿ + d₍ₙ₋₁₎ × 16ⁿ⁻¹ + … + d₁ × 16¹ + d₀ × 16⁰

For example, 0x1A3 = 1×256 + 10×16 + 3×1 = 256 + 160 + 3 = 419. Decimal-to-hex: repeatedly divide by 16, collect remainders (digits A–F for 10–15), read from bottom to top.

Why Hexadecimal Is Used in Computing

Hexadecimal exists as a human-readable shorthand for binary. Because 16 = 2⁴, every 4 binary bits map to exactly one hex digit. A byte (8 bits) needs only two hex characters — far more compact than 8 binary digits. This is why memory addresses, CPU registers, file format magic numbers, SHA hashes, and AES keys are always shown in hex. A 128-bit AES key written in binary would be 128 characters; in hex it is just 32 characters.

Hex Colors in Web Development

CSS hex colors (#RRGGBB) encode three color channels: red, green, and blue, each as a 2-digit hex value (00–FF). This gives 256 possible intensities per channel and 16,777,216 total colors. The 4-digit shorthand #RGBA and 8-digit #RRGGBBAA forms add an alpha (opacity) channel. Understanding hex color arithmetic lets you darken, lighten, or shift the hue of any color programmatically without a design tool.

Privacy Notice

All calculations in this hex calculator are performed entirely in your browser. No data you enter is transmitted to any server, stored in any database, or shared with third parties. See our Privacy Policy for full details.

Quick Reference

Input / ParameterDescriptionExample Value
Hex input (base 16)Digits 0–9 and A–F; prefix 0x optional0xFF or FF
Decimal input (base 10)Standard integer or decimal number255
Binary input (base 2)Digits 0 and 1 only11111111
Hex color (#RRGGBB)6-digit hex code for CSS/HTML colors#FF5733
RGB outputRed, green, blue channels each 0–255rgb(255, 87, 51)
HSL outputHue (0–360°), saturation, lightness (%)hsl(11, 100%, 60%)
Hex arithmetic resultSum, difference, product, or quotient in hex0x1F + 0x2A = 0x49
OutputDecimal equivalent, binary, and color preview255 | 11111111 | #FF

When to Use This Calculator

🎨
Web development color codes

Convert between #RRGGBB hex, RGB, and HSL to pick, verify, and adjust colors for CSS stylesheets, design systems, and UI components.

⚙️
Assembly and low-level programming

Work with CPU registers, opcodes, and memory-mapped hardware addresses that are always expressed in hexadecimal in datasheets and assembler code.

🐛
Memory debugging

Read and decode memory dumps, core files, and binary data in hex format when debugging segfaults, buffer overflows, or data corruption issues.

🌐
Networking protocols

Inspect Ethernet MAC addresses (e.g., AA:BB:CC:DD:EE:FF), IPv6 addresses, and raw packet bytes — all represented in hexadecimal in network tooling.

🎓
Computer science coursework

Convert numbers between decimal, hex, binary, and octal for assignments covering number systems, character encoding, and data representation.

💡 Pro Tips

1

Always prefix hex literals with 0x in code (e.g., 0xFF, 0x1A3F). This is the universal notation recognised by C, C++, JavaScript, Python, Rust, Go, and most other languages. Without the prefix, the compiler or interpreter may misread the value as a variable name or decimal.

2

Two hex digits equal exactly one byte (8 bits). A byte's range is 0x00–0xFF (0–255). This is why hex is the standard way to write memory addresses, byte arrays, file offsets, and cryptographic hashes — each pair of hex characters represents one byte of data.

3

Break down CSS hex colors using the #RRGGBB pattern: the first two digits control red intensity, the middle two control green, and the last two control blue. To lighten a color, increase all three values proportionally. To shift hue, adjust individual channels. Use this mental model to decode any CSS color at a glance.

4

Use hex for memory addresses and register values in low-level debugging. Debuggers, disassemblers, and memory viewers all display data in hex because it compresses binary data to a readable length while preserving exact bit patterns. A 32-bit address like 0xDEADBEEF is far more readable than its 32-digit binary equivalent.

Frequently Asked Questions

💻
Binary Calculator
Binary, octal, decimal conversion and bitwise ops
🧮
Scientific Calculator
Advanced math functions and operations

Your input is processed locally in your browser and is never stored, transmitted, or shared with any server. See our Privacy Policy.

Share This Tool

X / TwitterWhatsAppLinkedIn