Color Converter — HEX, RGB and HSL
Convert one supported sRGB color literal into HEX, RGB and HSL, including alpha. Copy a representation and check its rounding note; this is a focused converter, not a complete CSS parser or display-matching service.
Convert one color and choose its representation
- Paste a single HEX value beginning with #, or a supported rgb/rgba/hsl/hsla function. Use example fills #33669980 without converting. Use ASCII decimal dots; the syntax guide explains supported separators, units and ranges.
- Press Convert to see all three representations. The converter retains the unrounded encoded color and straight alpha, then formats each output independently. Editing the draft immediately retires the old result rather than leaving a stale color ready to copy.
- Copy one code string or use Copy all for three labelled lines. A Rounded note means that representation's numeric color differs after its stated rounding. Review alpha-byte qualifications; the swatch illustrates the displayed RGB string, not calibrated appearance.
Color channels, alpha and the supported syntax
HEX3 and HEX4 duplicate each digit; HEX6 and HEX8 use full bytes, with alpha last. RGB numbers use 0–255 and RGB percentages use 0–100%. Modern function syntax separates channels with spaces and alpha with a slash; legacy syntax uses commas. Modern RGB may mix numbers and percentages, while legacy RGB must use one channel type throughout.
Supported HSL uses degrees, optionally followed by deg, and percentage saturation and HSL lightness. Hue wraps around a circle; negative values are allowed within the tool limit. HSL lightness is not relative luminance or perceptual brightness. The conversion operates on encoded sRGB, not linear-light channels.
Alpha is independent of the stored RGB channels. A zero alpha does not erase hidden red, green or blue, and the converter does not blend the color onto a background. Functional output keeps alpha separately; HEX8 quantizes it to a byte, so 0.5 becomes 128/255 rather than exactly one half.
Equal RGB channels use the numeric convention H=0 and S=0. An authored hue on a neutral color cannot be recovered uniquely. For nonzero chroma this tool keeps the mathematical hue rather than applying a floating epsilon; CSS computed-style powerless or missing hue rules are a different contract, especially near neutral colors.
Understand exact values and rounded representations
#33669980 contains RGB bytes 51, 102 and 153 with alpha 128/255. Its encoded components are 0.2, 0.4 and 0.6, giving HSL 210 degrees, 50% saturation and 40% HSL lightness. HEX needs no rounding, while both functional outputs round alpha to 0.50196078.
hsl(210 100% 50% / .5) gives RGB channels 0, 127.5 and 255. Functional output can retain those numbers and alpha 0.5. HEX becomes #0080FF80 because channel and alpha ties round upward; it is marked Rounded rather than offered as an exact numerical equivalent.
rgb(17 34 51 / 99.999999%) keeps functional alpha 0.99999999, but its eight-bit alpha rounds to FF. The HEX result remains #112233FF, not a six-digit opaque claim, and includes the qualification. At the other end, 0.000001% alpha is retained functionally as 0.00000001 even when its HEX byte rounds to 00.
A deliberate subset with explicit output precision
The received draft fits 256 UTF-16 units before whitespace trimming, and numeric tokens fit 16 ASCII characters. RGB number channels and numeric alpha allow eight fractional digits; hue, all percentages and HSL S/L allow six. No exponent notation is accepted. Hue is bounded from -1000000 to +1000000 degrees. Components must fit their declared ranges rather than being silently clamped.
Names, transparent, currentColor, none, comments, escapes, other angle units, calculations, variables, relative colors, other color spaces and whole declarations or stylesheets are unsupported. S/L percentages are required in both HSL forms. Some excluded syntax is valid CSS, so an unsupported message here is not a standards-validity verdict.
HEX quantizes channels and alpha to nearest bytes with ties up. RGB channels and functional alpha use up to eight decimals; HSL hue, saturation and lightness use up to six. Values are independently rounded once, trailing zeros are removed, and a rounded hue of 360 becomes 0. No exact round trip, browser CSSOM serialization or identical rendering is promised.
There is no ICC, CMYK, wide-gamut, perceptual or display-profile conversion, contrast classification, image sampling or color-match certification. A browser swatch is only an illustration of validated generated RGB output. Do not confuse HSL lightness with an accessibility result or equal perceived brightness.
Local conversion and current clipboard output
This tool adds no upload, account, saved history, input logging or color-bearing share URL. It computes from the current draft in the browser and never renders arbitrary source CSS. Copy uses the requested current output; denial offers a matching readonly fallback. Existing site services remain subject to site policies; local processing does not certify those services or deployment.
Questions about HEX, RGB and HSL conversion
Source and method
CSS Color 4 describes the color formats and calculations used as context for this bounded converter.
- W3Cw3.orgHEX notationDigit lengths, channel order and alpha in hexadecimal notation.
- W3Cw3.orgRGB functionsRGB channel and alpha syntax.
- W3Cw3.orgHSL functionsHue, saturation and lightness syntax.
- W3Cw3.orgAlpha valuesAlpha represents opacity independently of color channels.
- W3Cw3.orgHSL to RGBConversion between HSL and encoded RGB components.
- W3Cw3.orgPowerless componentsHow a color component can be powerless, including neutral hue.
This converter implements a limited subset and its own rounding policy, not complete CSS conformance.
Related tools
SVG to PNG
Convert a local SVG file or pasted markup into PNG, with explicit dimensions, transparency and bundled fonts.
Open tool — SVG to PNGCSS Filter Generator
Order and repeat CSS effects, compare a specimen and copy the exact filter declaration.
Open tool — CSS Filter GeneratorFluid Font Size Calculator
Create root-relative CSS from viewport endpoints and inspect the copied size model.
Open tool — Fluid Font Size CalculatorCSS Button Generator
Style native button states, inspect keyboard focus and copy HTML and CSS.
Open tool — CSS Button GeneratorCSS Border Radius Generator
Edit eight corner radii, preview a box and copy CSS in pixels or percentages.
Open tool — CSS Border Radius GeneratorCSS Grid Generator
Build a bounded CSS Grid example with editable tracks, placement and named areas. Preview it, copy CSS or HTML and download the same standalone example.
Open tool — CSS Grid GeneratorCSS Flexbox Generator
Build a Flexbox example with container and item controls, explicit layout axes, matching CSS and HTML, and a local complete-example download.
Open tool — CSS Flexbox GeneratorCSS Text Shadow Generator
Build ordered text shadows, preview plain text and copy exact CSS.
Open tool — CSS Text Shadow GeneratorCSS Transform Generator
Compose repeatable 2D CSS transforms, edit px or percentage translation and origin, inspect a reference box and copy the exact current declarations.
Open tool — CSS Transform GeneratorCSS Box Shadow Generator
Create ordered CSS box-shadow layers with a live preview and copyable code.
Open tool — CSS Box Shadow GeneratorImage Watermark
Add a text or logo watermark to a batch of images, review each result and download individual files or a ZIP.
Open tool — Image WatermarkCSS Gradient Generator
Create linear or radial CSS gradients with editable colors, opacity and stops.
Open tool — CSS Gradient GeneratorImage to Text (OCR)
Recognize printed text in local PNG or JPEG images, choose a language and review or correct the result before copying or downloading.
Open tool — Image to Text (OCR)QR Code Reader
Read one QR code from a local PNG or JPEG and inspect its text or content bytes without opening links.
Open tool — QR Code ReaderColor Contrast Checker
Compare foreground and background colors, adjust opacity and check WCAG numerical contrast thresholds for text and essential interface details.
Open tool — Color Contrast CheckerPrint Size & Resolution Calculator
Calculate print dimensions, required pixels and effective PPI with fit or crop.
Open tool — Print Size & Resolution CalculatorAspect Ratio Calculator
Find a width-to-height ratio or calculate a matching pixel size from one target dimension.
Open tool — Aspect Ratio CalculatorImage Compressor
Try to fit a JPEG, PNG or WebP within a target file size, with measured results and optional smaller dimensions.
Open tool — Image CompressorHEIC to JPG
Convert supported HEIC photos locally into full-size JPG copies, with quality and background controls and verified individual or ZIP downloads.
Open tool — HEIC to JPGImage Converter
Convert supported PNG, JPEG and WebP images locally with batch targets, transparency, background and quality controls, then review and download the encoded files.
Open tool — Image ConverterPhoto Collage Maker
Arrange local photos in a grid, adjust crops and spacing, and download PNG or JPEG.
Open tool — Photo Collage MakerRotate & Flip Images
Rotate or mirror a local batch of static PNG, JPEG and WebP images, then review and download the processed results.
Open tool — Rotate & Flip ImagesImage Cropper
Crop one local JPEG, PNG or WebP to exact pixels with visual and numeric controls. Download PNG or JPEG.
Open tool — Image CropperImage Resizer
Resize a JPG, PNG or WebP image by pixels or percentage, preview the result and download it.
Open tool — Image Resizer