Color Picker
I like devformatter! ♥
A color picker is a browser-based tool that lets you visually select any color and instantly output its code in HEX, RGB, HSL, and HSB formats. This free online color picker from DevFormatter converts between all four formats in real time — no software to install, no data sent to any server.
Color Picker
How This Online Color Picker Works
Last updated: November 2026Part of DevFormatter — free browser-based developer tools, no signup required.
DevFormatter's free online color picker lets you visually select any color and instantly get its HEX code, RGB value, HSL, and HSB — all without leaving your browser. Drag the crosshair across the gradient square to set saturation and brightness, then drag the hue slider to change the color family. Every color code updates live as you drag.
You can also type directly into the HEX, RGB, or HSL fields — the color picker gradient updates to match. This makes the tool equally useful for finding a new color visually and for converting an existing code you already have. Once you have the HSL or HEX value, paste it straight into your stylesheet — if you need to format or minify that CSS, the CSS Formatter is one click away. Everything runs in your browser; no data is sent to any server.
Color Picker Output Formats: HEX, RGB, HSL and HSB
This color picker outputs four formats simultaneously. Here is when to use each one in your web projects.
| Format | Syntax | Color picker example | Best for |
|---|---|---|---|
| HEX | #rrggbb | #3b82f6 | HTML, CSS, design tools — the most common color picker output format |
| RGB | rgb(r, g, b) | rgb(59, 130, 246) | Canvas API, WebGL, programmatic color blending |
| HSL | hsl(h, s%, l%) | hsl(217, 91%, 60%) | CSS variables and design tokens — best format for generating color scales |
| HSB | hsb(h, s%, b%) | hsb(217, 76%, 96%) | Reading color values from Figma, Photoshop, and Illustrator color pickers |
Why color pickers in Figma show different numbers than CSS
HSL — what CSS color pickers use
Lightness 0% = black, 100% = white, 50% = the pure color. A fully saturated red at L=50% looks like pure red. CSS color pickers output HSL because it maps directly to CSS properties.
HSB — what Figma and Photoshop color pickers use
Brightness 100% = the pure color. White is S=0%, B=100%. Design tool color pickers use HSB because it matches how painters think about mixing color with white or black.
Color Picker Tips for Web Developers
Copy HSL for CSS variables
Pick your brand color, copy the HSL value, then define --hue: 217 in CSS. Derive all tints and shades with hsl(var(--hue), 91%, 60%). One session, unlimited variants.
Bridge Figma and CSS instantly
Figma outputs HSB; CSS needs HSL. Copy the HEX from Figma, paste it here, and read the CSS-ready HSL and RGB values without any manual calculation. Then drop the value straight into your stylesheet — use the CSS Formatter to clean up the file afterwards.
Type a HEX code to jump straight to any color
You don't have to drag — type a known HEX code directly into the field and the picker moves to that exact color. Useful for checking what RGB or HSL a brand HEX translates to.
3-digit HEX is valid shorthand
#f63 expands to #ff6633. The shorthand works only when both nibbles per channel are identical. The picker accepts 3-digit input and converts it automatically.
Add transparency after picking
All output values are fully opaque. To add transparency in CSS, append an alpha channel: rgba(59, 130, 246, 0.5) for 50% transparent, or the 8-digit hex #3b82f680.
Always check contrast after choosing a color
WCAG AA requires a 4.5:1 contrast ratio for body text. Run your chosen color through a contrast checker before using it in production. Dark shades at HSL L≈20% on white usually pass.
Color Conversion Code Examples
Once you have a color code from the picker, here is how to convert between HEX, RGB, and HSL programmatically — no library needed.
Node.js — HEX to RGB and HSL
// Pure math — no library needed
function hexToRgb(hex) {
const h = hex.replace('#', '');
return {
r: parseInt(h.slice(0, 2), 16),
g: parseInt(h.slice(2, 4), 16),
b: parseInt(h.slice(4, 6), 16),
};
}
function rgbToHsl(r, g, b) {
const [rn, gn, bn] = [r/255, g/255, b/255];
const max = Math.max(rn, gn, bn), min = Math.min(rn, gn, bn);
const l = (max + min) / 2;
if (max === min) return { h: 0, s: 0, l: Math.round(l * 100) };
const d = max - min;
const s = l > 0.5 ? d / (2 - max - min) : d / (max + min);
let h = max === rn ? ((gn - bn) / d + (gn < bn ? 6 : 0)) / 6
: max === gn ? ((bn - rn) / d + 2) / 6
: ((rn - gn) / d + 4) / 6;
return { h: Math.round(h * 360), s: Math.round(s * 100), l: Math.round(l * 100) };
}
const rgb = hexToRgb('#1e90ff'); // { r: 30, g: 144, b: 255 }
const hsl = rgbToHsl(rgb.r, rgb.g, rgb.b); // { h: 210, s: 100, l: 56 } Python — HEX to HSL via stdlib colorsys
import colorsys # stdlib — no pip install
def hex_to_rgb(hex_str):
h = hex_str.lstrip('#')
return tuple(int(h[i:i+2], 16) for i in (0, 2, 4))
def rgb_to_hsl(r, g, b):
h, l, s = colorsys.rgb_to_hls(r/255, g/255, b/255)
return round(h * 360), round(s * 100), round(l * 100)
rgb = hex_to_rgb('#1e90ff') # (30, 144, 255)
h, s, l = rgb_to_hsl(*rgb) # 210, 100, 56
print(f'HSL: hsl({h}, {s}%, {l}%)') CSS — HSL variables for dynamic theming
/* Use HEX for fixed brand colours */
.btn-primary { background: #1e90ff; }
/* Use HSL for dynamic theming via CSS variables */
:root {
--hue: 210;
--brand: hsl(var(--hue), 100%, 56%);
--brand-light: hsl(var(--hue), 100%, 72%);
--brand-dark: hsl(var(--hue), 100%, 35%);
}
/* Dark mode: only change lightness */
@media (prefers-color-scheme: dark) {
:root { --brand: hsl(var(--hue), 100%, 65%); }
} Color Picker — Frequently Asked Questions
- What is a color picker?
- A color picker is a tool that lets you visually select a color and instantly get its code in HEX, RGB, HSL, and HSB. This one runs entirely in the browser — drag the crosshair to choose saturation and brightness, drag the hue slider to change the color family, and all codes update in real time with no software to install. The gradient square represents a two-dimensional space where the horizontal axis controls saturation (from grey on the left to full color on the right) and the vertical axis controls brightness (from full brightness at the top to black at the bottom). The hue slider selects the color family from the full 360-degree spectrum. This layout, known as the HSB or HSV picker model, is used by virtually every professional tool including Figma, Photoshop, Sketch, and browser DevTools. Once you pick a color, the tool simultaneously outputs the CSS-ready HEX (
#3b82f6), RGB (rgb(59, 130, 246)), and HSL (hsl(217, 91%, 60%)) values, plus the design-tool HSB value. - What is a HEX color code?
- A HEX color code is a 6-character hexadecimal value prefixed with # (e.g.
#ff6347) that encodes the red, green, and blue channels of a color. Each 2-character pair represents a channel value from00(0 in decimal) toff(255 in decimal), so#ff6347means R=255, G=99, B=71 — the CSS named color "tomato". A shorthand 3-digit HEX is also valid when both nibbles of each channel are identical:#f63expands to#ff6633. An 8-digit HEX adds an alpha channel for transparency:#3b82f680is the same blue at 50% opacity (the last two digits represent 0–255 alpha). HEX is the most widely supported color format in HTML and CSS — it works in every browser back to IE6 — and is the default output of virtually every design tool's color picker, including Figma, Photoshop, and Sketch. Pick any color visually here and copy the HEX directly into your HTML or CSS stylesheet. - How do I use a color picker to get a HEX code?
- Drag the crosshair in the gradient square to select a color, then click Copy next to the HEX field to copy it to your clipboard. You can also type a known HEX value directly into the field — the gradient updates immediately to match. For example, type
#1a73e8(Google's brand blue) and the picker jumps to that exact hue, saturation, and brightness. This two-way binding makes the tool equally useful for exploring new colors visually and for converting an existing code you already have. Once you have the HEX, paste it straight into a CSS file:color: #1a73e8;or use it as a Tailwind arbitrary value:text-[#1a73e8]. The HSL and RGB values shown alongside the HEX are also click-to-copy, so you can grab whichever format your code or design system expects without any manual conversion. - What is the difference between an RGB and an HSL color picker?
- RGB outputs red, green, and blue values (0–255 each). HSL outputs hue (0–360°), saturation (0–100%), and lightness (0–100%), which is more intuitive for web design — to lighten a color just increase L, to make it less vivid just decrease S. For example,
hsl(217, 91%, 60%)is a medium blue;hsl(217, 91%, 80%)is a lighter tint of the same blue. HSL is the preferred format for CSS design tokens and theming because you can derive an entire color scale just by varying the lightness:--blue-100: hsl(217, 91%, 92%),--blue-500: hsl(217, 91%, 60%),--blue-900: hsl(217, 91%, 20%). RGB is used in programmatic contexts like the HTML5 Canvas API, WebGL shaders, and CSS animation where you need to interpolate between two colors by blending channel values. This tool shows RGB, HSL, HEX, and HSB all at once so you can copy whichever format your context requires. - How do I convert a color from Figma or Photoshop to CSS?
- Design tools output HSB (Hue, Saturation, Brightness); CSS uses HSL (Hue, Saturation, Lightness). The two are mathematically related but not interchangeable — a Figma color of HSB(217°, 76%, 96%) is the same as CSS HSL(217°, 91%, 60%), but the numbers look completely different. The simplest conversion workflow: copy the HEX code from Figma's color panel (the hex value is always shown below the HSB sliders), paste it into the HEX field of this color picker, and the CSS-ready HSL and RGB values appear instantly — no manual formula required. The same approach works in Photoshop (copy from the color picker dialog's # field) and Sketch (use the HEX value in the Fills panel). This avoids the rounding errors that occur when manually applying the HSB-to-HSL conversion formula, which involves several division and min/max steps.
- What is the difference between HSL and HSB?
- HSL Lightness: 50% is the pure color, 0% is black, 100% is white — so to get white in HSL you set L=100% regardless of saturation. HSB Brightness: 100% is the pure color, 0% is black — to get white in HSB you set S=0% and B=100%. This difference is the main reason the two models produce such different numbers for the same color. Figma and Photoshop use HSB because it matches the intuition of a painter who mixes colors by adding white (reducing saturation) or black (reducing brightness); CSS uses HSL because it allows uniform generation of tints and shades by varying only the L channel. Converting between the two requires the formula:
L = B × (1 − S/2)(where S and B are fractions, not percentages). Both HSL and HSB values are shown in this color picker simultaneously, so you can read either format for your target platform without any manual computation. - How do I use a picked color in CSS?
- Click Copy next to HEX, RGB, or HSL and paste into any CSS property value — for example
background-color: #3b82f6orcolor: rgb(59, 130, 246). For dynamic theming, use the HSL value with CSS custom properties: define--hue: 217and--sat: 91%in your:root, then writehsl(var(--hue), var(--sat), 60%)for the base color and vary only the lightness — 80% for a tint, 35% for a shade, 50% for dark-mode inversion. This approach lets you re-brand an entire design system by changing two variables. For dark mode, add@media (prefers-color-scheme: dark) { :root { --hue: 217; } }and adjust the lightness values per component. Use the CSS Formatter to clean up and minify the resulting stylesheet. - Can I type a color code into the picker?
- Yes. Type any valid HEX code (e.g.
#3b82f6) into the HEX field and the gradient updates immediately to show the picker positioned at that exact color. Editing the RGB or HSL fields also works — all four values and the picker position stay in sync automatically. The HEX field accepts both 6-digit (#rrggbb) and 3-digit (#rgb) shorthand formats; it does not currently accept 8-digit HEX with alpha. This two-way input makes the tool useful not just for picking new colors visually but also for converting an existing code you already have — for example, pasting a brand HEX from a style guide to quickly read its RGB and HSL equivalents without writing any code. If you are validating or converting many colors programmatically, consider using a library:chroma.js(JavaScript) or Python'scolorsysstdlib module handle batch conversion efficiently. - What color formats does CSS support?
- CSS supports named colors (tomato, rebeccapurple — there are 148 named colors in CSS), #rrggbb and #rgb hex (and #rrggbbaa / #rgba with alpha),
rgb(),rgba(),hsl(),hsla(), and CSS Color Level 4 formats:oklch(),lch(),lab(), andcolor(display-p3). The newer oklch() format is perceptually uniform, meaning equal steps in lightness look equally different to the human eye — it is gaining adoption in design systems like Tailwind CSS v4. HEX, RGB, and HSL output from this color picker covers almost every real-world use case across all browsers back to IE11. The CSS Color Level 4 formats currently require Chrome 111+, Firefox 113+, or Safari 15.4+. If you need to format, lint, or minify the stylesheet where you use these color values, use the CSS Formatter. - Is this color picker free?
- Yes — completely free, no account required, no data sent to any server, and no ads inside the tool. All color conversion runs entirely in your browser using JavaScript's native color math. The color picker is built on the open-source iro.js library which powers the gradient square and hue slider. Bookmark the page and use it any time — it even works offline once the page has loaded. DevFormatter offers a full suite of free developer tools alongside this color picker, including a CSS Formatter, Regex Tester, JSON Formatter, and many others. There are no paywalls, no rate limits, and no features gated behind a sign-up — every tool on DevFormatter is free for unlimited use.
- Does it work offline?
- Yes. Once the color picker page has loaded, disconnect from the internet and the tool keeps working — the gradient square, hue slider, field editing, and all HEX, RGB, HSL, and HSB conversions run entirely in the browser. This is possible because the color picker is a fully static page; no JavaScript network requests are made after initial load. If you use this tool regularly offline, consider adding the page to your browser's favorites so it loads from cache. For a fully installable offline experience, the page can be saved as a PWA on Chrome (use "Add to Home Screen" or "Install DevFormatter" from the browser menu). The only feature that requires a network connection is the Google Fonts stylesheet used for the preview text — the picker itself works without it.
Related Tools
Other free developer tools on DevFormatter.
Format, beautify and minify CSS, SCSS and Less stylesheets instantly.
Generate MD5, SHA-1, SHA-256, SHA-384 and SHA-512 hashes from any text.
Test regular expressions with live match highlighting.
Format, validate and minify JSON. Sort keys, find duplicates.
Encode or decode Base64 strings including URL-safe variant.
Build and validate cron expressions visually with live next-run previews.