Back to list
Tech

Hexadecimal #FF0000 = Red? A Programmer's Guide to Bases

2026-02-14 ConverterGo--

Hexadecimal Conversion Guide

Hexadecimal Guide

Number Systems for Programming and Data

While humans use the Decimal system, computers operate on Binary, and programmers often use Hexadecimal for better readability.

1. Key Number Bases

  • Decimal (Base 10): 0–9 (Human standard)
  • Binary (Base 2): 0, 1 (Computer hardware standard)
  • Hexadecimal (Base 16): 0–9 and A(10)–F(15). Four binary bits can be represented by a single hex digit, making data much easier to read.

2. Web Colors: RGB Hex Codes

The 6-digit hex code (#RRGGBB) used in HTML/CSS represents the intensity of Red, Green, and Blue from 00 to FF (255 in decimal).

  • #FF0000: Max Red → Red
  • #00FF00: Max Green → Green
  • #0000FF: Max Blue → Blue
  • #FFFFFF: Combination of all → White
  • #000000: Absence of light → Black

3. Conversion Rules

Hex → Decimal

Multiply each digit by the power of 16 and sum them up.

  • Example: 0x1A = 1 × 16¹ + 10 × 16⁰ = 26

Binary → Hex

Group bits into fours from the right and convert each set.

  • Example: 1010 1111 (binary) = AF (hex)

4. Programming Conventions

  • 0x Prefix: Used in C, C++, Java, JS, and Python to denote hexadecimal numbers.
  • # Prefix: Used in web standards to denote color codes.

👉 Try Our Number Base Converter