LazyTools

🔒 Every tool runs in your browser, the files and values you enter are never uploaded to any server. How it works

🔢 RGB to HEX Converter

rgb(29, 135, 241) converts to #1d87f1, each 0-255 channel written as a two-digit base-16 pair.

Rate this tool:
Anonymous, no account, no identifier

How the rgb to hex converter works

Each channel (0-255) becomes a two-digit hexadecimal number: divide by 16 for the first digit and take the remainder for the second, writing 10-15 as a, f. 241 ÷ 16 = 15 remainder 1 → f1; 135 ÷ 16 = 8 remainder 7 → 87; 29 ÷ 16 = 1 remainder 13 → 1d, concatenated as #1d87f1. Values below 16 get a leading zero (10 → 0a), the most common manual-conversion mistake, so every channel is always exactly two digits.

HEX is the compact form most tools, CSS codebases and brand guides standardize on, a single token that survives copy-paste. Converting from the RGB values a color picker or screenshot tool reports is a constant small task in design work.

Frequently asked questions

How do I convert RGB to HEX manually?

Divide each channel by 16: the quotient is the first digit, the remainder the second (10-15 become a, f). 241 ÷ 16 = 15 r 1 → f1.

Why does my HEX code look wrong with small values?

Channels under 16 need a leading zero: rgb(0, 10, 200) is #000ac8, not #0ac8. The converter pads automatically.

Can HEX express transparency?

Yes, 8-digit HEX appends an alpha pair: #1d87f180 is 50% transparent. Support is universal in modern browsers.

Is uppercase or lowercase HEX correct?

Both are valid and identical (#1D87F1 = #1d87f1); most style guides prefer lowercase for consistency.

Worked example: what is rgb(255, 165, 0) in HEX?

255 = ff, 165 ÷ 16 = 10 remainder 5 → a5, 0 = 00, so it is #ffa500, the classic web orange. Each channel converts independently.

Can I shorten a HEX code to three digits?

Only when each channel's two digits are a repeated pair: #1133ff can shorten to #13f, but #1d87f1 cannot because 1d, 87 and f1 are not doubled digits. When in doubt keep the full six digits, every colour has a valid six-digit form.

Is anything uploaded?

No, local, instant, works offline.

Related color tools

From the blog