Small Utility Lab

LOCAL HEX AND RGB CONVERTER

Convert hex colors and RGB channels in your browser.

Convert 3-, 4-, 6-, and 8-digit sRGB hex colors to RGB or RGBA values, and convert integer RGB channels back to hex. Processing stays in your browser.

Hex to RGB

Enter 3, 4, 6, or 8 hexadecimal digits, optionally starting with #. Four- and eight-digit forms include alpha.

Result

rgb(58, 123, 213) · R 58, G 123, B 213

Conversion runs locally in this browser.

RGB to Hex

Each channel must be an integer from 0 to 255.

Result

#3a7bd5

Conversion runs locally in this browser.

How the conversion works

A six-digit hex color stores one byte each for sRGB red, green, and blue. Each pair is parsed as a base-16 integer from 0 to 255. Three-digit shorthand repeats each digit, so #f08 expands to #ff0088, or rgb(255, 0, 136). Four- and eight-digit forms add an alpha byte after blue: #f008 expands to #ff000088, where alpha 00 is transparent and ff is opaque. The alpha byte is divided by 255 for the CSS rgba() value; for example, 80 becomes about 0.502. The reverse converter still accepts three integer RGB channels and writes six-digit hex with no alpha. This changes notation only; it does not change the color space or calculate contrast. Method checked against CSS Color 4 on November 5, 2026. Page content updated November 5, 2026.

Frequently asked questions

Can I enter a hex value without #?

Yes. Enter three, four, six, or eight digits, with or without the leading #.

How do four- and eight-digit hex alpha values work?

The last hex digit in four-digit shorthand, or the last byte in eight-digit form, is alpha. 00 means transparent and ff means opaque. The converter shows that byte and its decimal fraction from 0 to 1.

Does it accept named colors?

No. It accepts only 3-, 4-, 6-, and 8-digit hex colors, not CSS color names or other color syntaxes.

What range can RGB channels use?

Each red, green, and blue channel must be a whole-number integer from 0 through 255.

Are my color values sent anywhere?

No. Conversion runs in this browser tab. The page does not upload the entered colors or make an external data request.

Is it free?

Yes, during beta. Optional usage-credit plans are coming soon. Payments are not available and no credits are required.

Sources

Color syntax checked November 5, 2026.

How it works

1. Enter a 3-, 4-, 6-, or 8-digit hex color, with or without #, then convert to RGB or RGBA. Four- and eight-digit forms include an alpha byte. 2. Or enter red, green, and blue integer channels from 0 to 255 and convert to six-digit hex. Both conversions run locally.

Good to know

Which hex formats are accepted?

Enter 3-, 4-, 6-, or 8-digit hexadecimal sRGB values, optionally with a leading #. Four- and eight-digit forms include alpha. Named colors are not accepted.

How does hex alpha work?

In four- and eight-digit forms, the final digit or byte is alpha: 00 is transparent and ff is opaque. For example, #f008 expands to #ff000088 and converts to rgba(255, 0, 0, 0.5333333333333333).

What values are valid for RGB channels?

Red, green, and blue must each be a whole-number integer from 0 through 255.

Are my colors uploaded?

No. Parsing and conversion run locally in this browser tab.

Is it free?

Yes, during beta. Optional usage-credit plans are coming soon. Payments are not available and no credits are required.

Methodology and limitations

Accept an optional # followed by exactly 3, 4, 6, or 8 hexadecimal digits. Expand each nibble in 3- and 4-digit shorthand by repeating it. Parse red, green, blue, and optional trailing alpha bytes as base-16 integers; convert alpha to a fraction by dividing its byte by 255. For the reverse direction, require three whole-number channels from 0 through 255 and format each as a two-digit lowercase hexadecimal byte, without alpha. This converts sRGB notation only; it does not handle named colors, other color spaces, or contrast.