Hex to RGB Color Converter

Hex to RGB Color Converter

Hex to RGB Color Converter

Convert hexadecimal color codes to RGB values

Hex Color Input

#4a6fa5

RGB Results

Red:
74
Green:
111
Blue:
165
RGB:
rgb(74, 111, 165)
Red: 74
Green: 111
Blue: 165



A Hex to RGB Color Converter is a tool that translates hexadecimal (hex) color codes into their corresponding RGB (Red, Green, Blue) values. Hex codes are widely used in web design, digital graphics, and coding, while RGB values are essential for screen display and software development.


1. Hexadecimal Color Codes

  • Format: #RRGGBB (6 digits) or #RGB (3-digit shorthand).
  • Each pair (RR, GG, BB) represents red, green, and blue intensity.
  • Values range from 00 (minimum) to FF (maximum) in hexadecimal, equivalent to 0–255 in decimal.

2. RGB Color Model


  • Represents colors as combinations of Red, Green, and Blue intensities.
  • Each channel ranges from 0 to 255 (e.g., RGB(255, 0, 0) = pure red).

Conversion Process


1. 6-Digit Hex Code (#RRGGBB) to RGB


1.Split the hex code into three pairs:

  • RR → Reb
  • GG → Green
  • BB → Blue

2. Convert each pair from hexadecimal (base-16) to decimal (base-10).

Example:

   Hex: #1A2B3C

  • Red: 1A → (1 × 16) + 10 = 26
  • Green: 2B → (2 × 16) + 11 = 43
  • Blue: 3C → (3 × 16) + 12 = 60
  • RGB Output: RGB(26, 43, 60)

2. 3-Digit Short Hex (#RGB) to RGB


  • Each digit is duplicated (e.g., #F53 becomes #FF5533).
  • Then, convert as usual.

Example:

   Hex: #0A8

  • Expanded: #00AA88
  • Red: 00 → 0
  • Green: AA → 170
  • Blue: 88 → 136
  • RGB Output: RGB(0, 170, 136)