hex rgb calculator

Accepts 3-digit or 6-digit HEX values.
Each channel must be between 0 and 255.
#1E73BE
Ready. Enter a HEX or RGB value to convert.

What this HEX/RGB calculator does

This tool converts colors between two common formats used in web design and front-end development: HEX and RGB. Whether you are styling a button in CSS, matching a brand color, or building a design system, fast conversion helps avoid mistakes and saves time.

Example: #1E73BE is the same color as rgb(30, 115, 190).

HEX vs RGB: quick overview

HEX format

HEX is a base-16 color code written with a hash sign and six characters, such as #FF6600. Each pair represents red, green, and blue channels.

  • #RRGGBB is the standard 6-digit format.
  • #RGB is shorthand, where each value is doubled. Example: #0FA#00FFAA.

RGB format

RGB expresses color with numeric channel values from 0 to 255, like rgb(255, 102, 0). This is intuitive when adjusting color intensity directly.

  • R = red channel strength
  • G = green channel strength
  • B = blue channel strength

How to use this calculator

Convert HEX to RGB

Enter a HEX value (3 or 6 digits), then click Convert HEX → RGB. The RGB inputs are auto-filled, and the color preview updates instantly.

Convert RGB to HEX

Fill red, green, and blue values (0–255), then click Convert RGB → HEX. The HEX field is generated in uppercase, and the preview updates.

Generate a random color

Click Random Color to quickly explore palettes and inspiration for UI themes, data visualization, and branding experiments.

Common conversion mistakes to avoid

  • Forgetting the valid range for RGB values (must be 0–255).
  • Using invalid HEX characters (only 0–9 and A–F are allowed).
  • Confusing 3-digit HEX with 6-digit HEX during manual conversion.
  • Copying values with extra spaces or missing symbols.

Practical use cases

This calculator is especially useful for:

  • CSS styling and theme customization
  • Design handoff between Figma and code
  • Accessibility checks and contrast tooling workflows
  • Marketing pages and brand color consistency
  • Email templates and dashboard interfaces

FAQ

Can I use shorthand HEX like #ABC?

Yes. The calculator expands it to #AABBCC automatically before converting.

Does it support alpha transparency?

This version focuses on standard HEX and RGB conversion. If needed, it can be extended to support RGBA and 8-digit HEX (#RRGGBBAA).

Final thoughts

Color conversion is a small but essential part of web development. A reliable HEX/RGB calculator keeps your workflow fast, consistent, and less error-prone. Bookmark this page and use it whenever you switch between design specs and production code.

🔗 Related Calculators

🔗 Related Calculators