Favorite places of your favorite city
Home
Add to preferred sources on Google

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.

Color converter

Alpha: 100%

Enter a HEX, RGB or HSL color

Result

Enter one supported color.

Conversion runs in your browser without tool-added uploads or saved history. Copy uses your clipboard only when requested. Other site services remain subject to site policies.

Convert one color and choose its representation

  1. 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.
  2. 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.
  3. 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

This version deliberately accepts a bounded subset of standalone HEX/RGB/HSL literals. CSS also has names, other spaces and angle units, calculations, missing components and broader number syntax. The tool rejects rather than silently interpreting or clamping those forms.

An alpha byte has 256 levels. Multiplying one half by 255 gives 127.5, which this tool rounds upward to 128, hexadecimal 80. Dividing that byte by 255 is not exactly one half; functional output is calculated independently and can retain 0.5.

No. Straight alpha is carried separately, so a fully transparent red still has red RGB values. The swatch may show only the checkerboard, but the output does not premultiply or erase hidden channels.

Equal RGB channels have no unique hue, so their canonical numerical HSL uses zero. A very small hue difference near 360 can also round to 360 and then wrap to zero; that changed numerical representation is marked Rounded. Neither case claims to recover a powerless authored hue.

CSS code always uses ASCII digits and a decimal dot. Only surrounding explanations and labels are localized. Copy all uses the fixed technical prefixes HEX, RGB and HSL, LF between its three lines and no final newline.

No. It is a coordinate of this encoded RGB-based color model, not relative luminance or a perceptual uniformity scale. This tool converts representations and does not calculate an accessibility pass or certify a display match.

Source and method

CSS Color 4 describes the color formats and calculations used as context for this bounded converter.

This converter implements a limited subset and its own rounding policy, not complete CSS conformance.

SVG to PNG

Convert a local SVG file or pasted markup into PNG, with explicit dimensions, transparency and bundled fonts.

Open tool — SVG to PNG

CSS Filter Generator

Order and repeat CSS effects, compare a specimen and copy the exact filter declaration.

Open tool — CSS Filter Generator

Fluid Font Size Calculator

Create root-relative CSS from viewport endpoints and inspect the copied size model.

Open tool — Fluid Font Size Calculator

CSS Button Generator

Style native button states, inspect keyboard focus and copy HTML and CSS.

Open tool — CSS Button Generator

CSS Border Radius Generator

Edit eight corner radii, preview a box and copy CSS in pixels or percentages.

Open tool — CSS Border Radius Generator

CSS 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 Generator

CSS 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 Generator

CSS Text Shadow Generator

Build ordered text shadows, preview plain text and copy exact CSS.

Open tool — CSS Text Shadow Generator

CSS 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 Generator

CSS Box Shadow Generator

Create ordered CSS box-shadow layers with a live preview and copyable code.

Open tool — CSS Box Shadow Generator

Image 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 Watermark

CSS Gradient Generator

Create linear or radial CSS gradients with editable colors, opacity and stops.

Open tool — CSS Gradient Generator

Image 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 Reader

Color 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 Checker

Print Size & Resolution Calculator

Calculate print dimensions, required pixels and effective PPI with fit or crop.

Open tool — Print Size & Resolution Calculator

Aspect Ratio Calculator

Find a width-to-height ratio or calculate a matching pixel size from one target dimension.

Open tool — Aspect Ratio Calculator

Image Compressor

Try to fit a JPEG, PNG or WebP within a target file size, with measured results and optional smaller dimensions.

Open tool — Image Compressor

HEIC 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 JPG

Image 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 Converter

Photo Collage Maker

Arrange local photos in a grid, adjust crops and spacing, and download PNG or JPEG.

Open tool — Photo Collage Maker

Rotate & 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 Images

Image Cropper

Crop one local JPEG, PNG or WebP to exact pixels with visual and numeric controls. Download PNG or JPEG.

Open tool — Image Cropper

Image Resizer

Resize a JPG, PNG or WebP image by pixels or percentage, preview the result and download it.

Open tool — Image Resizer
View all tools in this category