Decimal ↔ Hex Converter
Free online Decimal to Hex Converter. Convert base-10 to base-16 hexadecimal instantly. Supports BigInt, two's complement, 8–64 bit signed/unsigned, and live steps.
Decimal ↔ Hexadecimal Converter
| Step | Operation & Division | Hex Digit | Result So Far |
|---|---|---|---|
| 1 | 255 ÷ 16 = 15 remainder 15 | F | F |
| 2 | 15 ÷ 16 = 0 remainder 15 | F | FF |
Overview
The ToolMono Decimal ↔ Hex Converter is an enterprise-grade base conversion platform engineered for software developers, systems engineers, cybersecurity researchers, and students. It converts base-10 decimal integers to base-16 hexadecimal numbers—and vice versa—in real time with 100% client-side precision.
With support for BigInt arbitrary precision, 8-bit to 64-bit Two's Complement signed representation, custom 0x prefix formatting, uppercase/lowercase toggling, and step-by-step division-by-16 mathematical breakdowns, ToolMono is the definitive reference tool for low-level data manipulation. Explore companion tools: Binary ↔ Decimal Converter, Decimal ↔ Octal Converter, Online Calculator, Scientific Calculator, JSON Formatter, and Hash Generator.
How to Use
Type any decimal integer (e.g. 255) or hex string (e.g. 0xFF or 7FFF) into the input box.
Toggle Uppercase (FF) vs Lowercase (ff) and include or omit the 0x prefix.
View live binary, octal, signed two's complement representations, and division-by-16 step breakdown.
Click the Copy button to instantly save formatted hex or decimal output to your clipboard.
Decimal and Hexadecimal Number Systems
Numerical systems provide structured ways to express numbers using sets of symbols and positional weighting rules. In daily human society, we use the decimal system, whereas low-level computing architectures frequently utilize the hexadecimal system.
Decimal (Base 10)
The decimal system relies on ten unique digits:
Each digit position in a base-10 number represents a successive power of 10. For instance, the decimal number 425 is evaluated as:
Hexadecimal (Base 16)
The hexadecimal system uses sixteen unique symbols:
Because base-10 single digits end at 9, letters A through F represent values 10 to 15:
Each positional column represents a power of 16. For example, 2F₁₆ evaluates as:
Powers of 16 Reference
Understanding hexadecimal place values requires evaluating powers of 16 ($16^n$). The rightmost hexadecimal digit always represents $16^0 = 1$. Moving one position to the left multiplies the positional weight value by 16.
| Position Index (n) | Power Notation | Decimal Multiplier Value |
|---|---|---|
| 0 | 16⁰ | 1 |
| 1 | 16¹ | 16 |
| 2 | 16² | 256 |
| 3 | 16³ | 4,096 |
| 4 | 16⁴ | 65,536 |
| 5 | 16⁵ | 1,048,576 |
| 6 | 16⁶ | 16,777,216 |
| 7 | 16⁷ | 268,435,456 |
To evaluate 1A3₁₆ using positional powers:
How to Convert Decimal to Hexadecimal
Converting a base-10 decimal number to base-16 hexadecimal is performed using the successive division by 16 method.
- Divide the decimal number by 16 to get an integer quotient and remainder.
- Record the remainder value (range 0 to 15).
- If the remainder is between 10 and 15, map it to its corresponding hex letter (10 → A, 11 → B, 12 → C, 13 → D, 14 → E, 15 → F).
- Take the integer quotient and divide it by 16 again.
- Repeat division until the quotient becomes 0.
- Read the recorded hex remainders in reverse order (from bottom to top).
| Division Step | Integer Quotient | Remainder | Hexadecimal Digit |
|---|---|---|---|
| 254 ÷ 16 | 15 | 14 | E |
| 15 ÷ 16 | 0 | 15 | F |
How to Convert Hexadecimal to Decimal
To convert a base-16 hexadecimal number back to base-10 decimal, apply the positional expansion method.
- Identify the position index of each digit starting with index 0 at the rightmost character.
- Assign positional powers of 16 ($16^0, 16^1, 16^2, \dots$) moving right to left.
- Convert any hex letter (A–F) into its decimal numeric equivalent (10–15).
- Multiply each digit value by its corresponding power of 16.
- Sum all positional contributions to get the total base-10 decimal value.
| Hex Digit | Decimal Value | Power ($16^n$) | Positional Contribution |
|---|---|---|---|
| 1 | 1 | 16² (256) | 1 × 256 = 256 |
| A | 10 | 16¹ (16) | 10 × 16 = 160 |
| 3 | 3 | 16⁰ (1) | 3 × 1 = 3 |
Hexadecimal Digit Reference Table (0–15)
The table below shows all 16 hexadecimal symbols alongside their base-10 decimal equivalents and 4-bit binary nibble representations:
| Hex Digit | Decimal Value | 4-bit Binary Nibble |
|---|---|---|
| 0 | 0 | 0000 |
| 1 | 1 | 0001 |
| 2 | 2 | 0010 |
| 3 | 3 | 0011 |
| 4 | 4 | 0100 |
| 5 | 5 | 0101 |
| 6 | 6 | 0110 |
| 7 | 7 | 0111 |
| 8 | 8 | 1000 |
| 9 | 9 | 1001 |
| A | 10 | 1010 |
| B | 11 | 1011 |
| C | 12 | 1100 |
| D | 13 | 1101 |
| E | 14 | 1110 |
| F | 15 | 1111 |
Why Hexadecimal Is Used in Computing
In computer science and digital electronics, hexadecimal is invaluable because one hexadecimal digit represents exactly four binary bits (one nibble) ($2^4 = 16$).
Raw binary strings are long and cumbersome for human engineers to read or transcribe without making mistakes. Hexadecimal provides a direct, perfectly aligned 4-to-1 compression of binary data:
Common contexts where hexadecimal representation is essential include:
- Byte Values & Machine Code: Expressing 8-bit bytes concisely as two hex characters (e.g.
0x00to0xFF). - Memory & Debugging Output: Inspecting RAM pointers, stack traces, and core dumps (e.g.
0x7FFF5FBFF000). - Low-Level Bit Fields & Flags: Configuring hardware registers using explicit bit masks (e.g.
0x80for MSB flag). - Network Packet Traces: Examining raw Ethernet headers, IP payloads, and MAC addresses in Wireshark.
- Binary Data Files & Hex Editors: Viewing compiled binaries, executable file headers (e.g.
0x4D5Afor PE headers), and disk sectors.
Bits, Nibbles, and Bytes
Digital computer memory is structured around fundamental units of binary information. Hexadecimal maps cleanly to these structural units:
The smallest unit of data, containing a single binary value:
A group of 4 binary bits. 1 hex digit represents exactly 1 nibble:
A group of 8 binary bits. 2 hex digits represent exactly 1 byte:
An unsigned 8-bit byte spans decimal values 0 to 255, which corresponds to hexadecimal 00 to FF.
Hexadecimal and the 0x Prefix
In source code and developer documentation, hexadecimal numbers are almost always prefixed with 0x or 0X (e.g., 0xFF, 0x1A, 0x100).
The 0x prefix stems from the C programming language and is now standard across C++, Java, JavaScript, Python, Rust, Go, and C#.
0x prefix identifies the string as hexadecimal syntax. It is not a digit and does not alter the numeric value. ToolMono's converter automatically strips 0x on input and includes a toggle to add or omit 0x in output results.Uppercase and Lowercase Hexadecimal
Hexadecimal representation is case-insensitive for the digits A–F. Uppercase and lowercase letters represent identical numerical quantities:
Developers choose between uppercase or lowercase formatting depending on project conventions or language standards (e.g. CSS colors often use uppercase #FF0000 or lowercase #ff0000, while C formatting uses %X vs %x). ToolMono provides a live Letter Case toggle button to instantly switch output between UPPERCASE and lowercase.
Leading Zeros and Fixed-Width Hexadecimal
In mathematical terms, F and 0F both represent the exact same decimal value: 15₁₀. However, in software engineering, leading zeros define fixed-width field representation.
Decimal 15 formatted as an 8-bit byte:
Decimal 15 formatted as a 16-bit word:
Fixed-width zero padding ensures consistent visual width when displaying memory dumps, CPU register contents, fixed protocol fields, and checksums.
Common Conversion Reference Examples
Below is a reference lookup table for common decimal integers and their corresponding hexadecimal values across standard 8-bit byte widths:
| Decimal Value | Hexadecimal Value | Common Bit Width / Context |
|---|---|---|
| 0 | 00 | 8-bit (Byte Min) |
| 1 | 01 | 8-bit |
| 10 | 0A | 8-bit |
| 15 | 0F | 8-bit (Nibble Max) |
| 16 | 10 | 8-bit |
| 31 | 1F | 8-bit |
| 32 | 20 | 8-bit (ASCII Space) |
| 64 | 40 | 8-bit |
| 100 | 64 | 8-bit |
| 127 | 7F | 8-bit Signed Max |
| 128 | 80 | 8-bit Signed Min Bit |
| 200 | C8 | 8-bit |
| 255 | FF | 8-bit Unsigned Max (Byte Max) |
| 256 | 100 | 16-bit Boundary |
| 1024 | 400 | 16-bit Boundary (1 KB) |
Hexadecimal Conversion Verification Method
To verify a hexadecimal conversion result manually without a calculator, perform polynomial expansion:
Common Conversion Mistakes to Avoid
Confusing hex digits A–F with arbitrary letters rather than their fixed values (A=10, B=11, C=12, D=13, E=14, F=15).
Reading remainders top-to-bottom instead of bottom-to-top when performing successive division by 16.
Interpreting 1A as decimal $1 \times 10 + 10 = 20$, instead of base-16 $1 \times 16 + 10 = 26$.
Evaluating ABC as $A+B+C$ ($10+11+12=33$) instead of $A \times 16^2 + B \times 16^1 + C \times 16^0 = 2748$.
Decimal, Hexadecimal, and Binary Relationship
The table below illustrates how the three primary computer number systems relate to each other:
| Number System | Base | Allowed Digits / Symbols |
|---|---|---|
| Binary | 2 | 0 1 |
| Decimal | 10 | 0 1 2 3 4 5 6 7 8 9 |
| Hexadecimal | 16 | 0 1 2 3 4 5 6 7 8 9 A B C D E F |
Need to convert base-2 binary strings directly? Check our companion Binary ↔ Decimal Converter.
Key Features
Instant base conversion on every keystroke without requiring button clicks or server calls.
Convert numbers with hundreds or thousands of digits without encountering double-precision floating-point limits.
Full support for signed negative integers with 8-bit, 16-bit, 32-bit, and 64-bit two's complement rendering.
Bit Width & Integer Bounds
| Bit Width | Unsigned Range (Decimal) | Unsigned Range (Hex) | Signed Range (Decimal) |
|---|---|---|---|
| 8-bit (Byte) | 0 to 255 | 0x00 to 0xFF | -128 to 127 |
| 16-bit (Word) | 0 to 65,535 | 0x0000 to 0xFFFF | -32,768 to 32,767 |
| 32-bit (DWord) | 0 to 4,294,967,295 | 0x00000000 to 0xFFFFFFFF | -2,147,483,648 to 2,147,483,647 |
| 64-bit (QWord) | 0 to 18,446,744,073,709,551,615 | 0x0000000000000000 to 0xFFFFFFFFFFFFFFFF | -9.22 × 10^18 to 9.22 × 10^18 |
Signed Integers & Two's Complement
A hexadecimal bit pattern can represent different values depending on whether it is treated as an unsigned integer or as a signed fixed-width Two's Complement integer.
Hexadecimal in Programming & Code Examples
Hexadecimal literals are used extensively in programming for bit masking, flag evaluation, byte array initialization, and memory inspection.
const dec = 255; const hex = dec.toString(16).toUpperCase(); // 'FF' const hexWithPrefix = '0x' + hex; // '0xFF'
const hex = '0xFF';
const dec = parseInt(hex, 16); // 255
const bigDec = BigInt('0xFF'); // 255ndec_val = 255 hex_val = hex(dec_val) # '0xff' hex_upper = hex(dec_val)[2:].upper() # 'FF'
hex_str = '0xFF' dec_val = int(hex_str, 16) # 255
int dec = 255; String hex = Integer.toHexString(dec).toUpperCase(); // "FF"
String hex = "FF"; int dec = Integer.parseInt(hex, 16); // 255
package main
import "fmt"
func main() {
dec := 255
hex := fmt.Sprintf("%X", dec) // "FF"
}package main
import ("fmt"; "strconv")
func main() {
dec, _ := strconv.ParseInt("FF", 16, 64) // 255
}#include <stdio.h>
int main() {
int dec = 255;
printf("%X\n", dec); // FF
return 0;
}#include <stdio.h>
int main() {
int dec;
sscanf("FF", "%x", &dec); // 255
return 0;
}let dec = 255;
let hex = format!("{:X}", dec); // "FF"let hex = "FF"; let dec = i64::from_str_radix(hex, 16).unwrap(); // 255
int dec = 255;
string hex = dec.ToString("X"); // "FF"string hex = "FF"; int dec = Convert.ToInt32(hex, 16); // 255
$dec = 255; $hex = strtoupper(dechex($dec)); // 'FF'
$hex = 'FF'; $dec = hexdec($hex); // 255
let dec = 255 let hex = String(dec, radix: 16, uppercase: true) // "FF"
let hex = "FF" let dec = Int(hex, radix: 16) // 255
val dec = 255 val hex = dec.toString(16).uppercase() // "FF"
val hex = "FF" val dec = hex.toInt(16) // 255
-- PostgreSQL SELECT to_hex(255); -- 'ff' -- MySQL SELECT HEX(255); -- 'FF'
-- PostgreSQL
SELECT ('x' || lpad('FF', 8, '0'))::bit(32)::int; -- 255
-- MySQL
SELECT CONV('FF', 16, 10); -- 255Common Hexadecimal Use Cases & Developer Notes
RGB(255, 0, 128) converts to Hex #FF0080 for web design.
Decimal 32767 maps to RAM pointer 0x7FFF in GDB/LLDB.
HTTP Port 8080 translates to 0x1F90 in packet dumps.
Microcontroller register configuration using bitmask 0xF0.
ASCII 'A' (65₁₀) converts to Hex 0x41 in hex editors.
x86 Assembly opcodes specified in hex (e.g. 0x90 for NOP).
Quick Hexadecimal Conversion Cheat Sheet
- Repeatedly divide by 16.
- Record each remainder.
- Convert remainders 10–15 to A–F.
- Read remainders from bottom to top.
- Convert hex letters A–F to 10–15.
- Multiply each digit by its power of 16.
- Sum all positional values.
In-Depth Educational Guide
Why Do Computers Rely on Hexadecimal?
Modern digital computers operate strictly on binary logic gates (high voltage = 1, low voltage = 0). However, writing raw binary strings like 1101011010111111 is prone to human typing errors and difficult to scan quickly.
Because $16 = 2^4$, exactly 4 binary bits (a nibble) compress into 1 hexadecimal digit. This 4-to-1 ratio allows 8-bit bytes to be represented as exactly 2 hex digits (00 to FF), and 32-bit words to be represented as 8 hex digits (0x00000000 to 0xFFFFFFFF).
Manual Division-by-16 Algorithm
To convert a decimal integer to hexadecimal by hand:
- Divide the decimal number by 16.
- Record the integer quotient and the remainder (0–15).
- Convert the remainder to its hex character (10 -> A, 11 -> B, ..., 15 -> F).
- Repeat the process with the quotient until it reaches 0.
- Read the hex remainders in reverse order (bottom to top).
AI Overview Answers
Decimal to Hex conversion is the process of translating base-10 integers (0–9) into base-16 hexadecimal numbers (0–9 and A–F). Hexadecimal notation provides a compact, human-readable representation of binary computer memory and data values.
Frequently Asked Questions
References & Standards
IEEE 754-2019: Standard for Floating-Point Arithmetic
IEEE specification for hexadecimal floating-point representations.
MDN Web Docs: Hexadecimal Literals & Conversion
Mozilla guide to radix 16 conversions in JavaScript.
ECMAScript Lexical Grammar: Numeric Literals
Official ECMA standard for 0x hexadecimal literal prefixes.
Related Tools
Browse all toolsBinary ↔ Decimal Converter
Free online Binary Decimal Converter. Convert binary base-2 to decimal base-10 instantly. Supports BigInt, two's complement, 8–256 bit signed, and step breakdown.
Decimal to Octal Converter
Free online Decimal to Octal converter with instant step-by-step division steps. Convert Base-10 to Base-8 and Octal to Decimal accurately in your browser.
Online Calculator
Use ToolMono's free online calculator for quick everyday math, expressions, percentages, powers, roots, and parentheses. Includes calculation history and keyboard support.
Percentage Calculator
Calculate percentages instantly with ToolMono's free online percentage calculator. Find X% of Y, calculate what percent X is of Y, and solve reverse percentages.
Scientific Calculator
Use ToolMono's free Scientific Calculator for advanced mathematical calculations. Supports trigonometric, inverse, hyperbolic, logarithmic, exponential, factorial, scientific notation, degree/radian modes, calculation history, and 100% client-side processing.
Timestamp Converter
Convert Unix timestamps to dates and dates to timestamps instantly. Supports seconds, milliseconds, microseconds, nanoseconds, UTC, local time, and ISO 8601.
JSON Formatter
Free online JSON formatter, beautifier, and validator. Format, indent, minify, and inspect JSON with real-time syntax error detection in your browser. 100% client-side.
Hash Generator
Generate hashes and file checksums locally in your browser. Compare digests, copy results, and use MD5, SHA-1, SHA-2, SHA-3, BLAKE2, and supported HMAC algorithms.
Online UUID & GUID Generator
Generate secure UUID v4 and time-ordered UUID v7 identifiers online. Create single or bulk UUIDs with formatting controls, GUID support, and client-side Web Crypto generation.