⚙️ Settings
WITH recent_orders AS (
SELECT
customer_id,
order_id,
order_date,
total_amount
FROM orders
WHERE order_date >= DATEADD(day, -30, GETDATE())
)
SELECT
customer_id,
COUNT(order_id) AS order_count,
SUM(total_amount) AS total_spent
FROM recent_orders
GROUP BY customer_id
ORDER BY total_spent DESC;
WITH RECURSIVE employee_hierarchy AS (
-- Anchor: top-level rows (no manager)
SELECT
employee_id,
manager_id,
employee_name,
1 AS level
FROM employees
WHERE manager_id IS NULL
UNION ALL
-- Recursive: join children to their parent's result
SELECT
e.employee_id,
e.manager_id,
e.employee_name,
eh.level + 1
FROM employees e
INNER JOIN employee_hierarchy eh
ON e.manager_id = eh.employee_id
)
SELECT *
FROM employee_hierarchy
ORDER BY level, employee_name;
-- Note: SQL Server / Oracle: drop the RECURSIVE keyword (just WITH employee_hierarchy AS (...))
SELECT
o.order_id,
c.customer_name,
o.order_date,
p.product_name,
oi.quantity
FROM orders o
INNER JOIN customers c
ON o.customer_id = c.customer_id
LEFT JOIN order_items oi
ON o.order_id = oi.order_id
LEFT JOIN products p
ON oi.product_id = p.product_id
WHERE o.order_date >= '2026-01-01'
ORDER BY o.order_date DESC;
SELECT
DATE_TRUNC('month', order_date) AS order_month, -- PostgreSQL
-- FORMAT(order_date, 'yyyy-MM') AS order_month, -- SQL Server
-- DATE_FORMAT(order_date, '%Y-%m') AS order_month, -- MySQL
COUNT(*) AS order_count,
SUM(total_amount) AS revenue
FROM orders
GROUP BY DATE_TRUNC('month', order_date)
ORDER BY order_month;
SELECT
customer_id,
order_id,
order_date,
total_amount,
ROW_NUMBER() OVER (
PARTITION BY customer_id
ORDER BY order_date DESC
) AS order_rank,
SUM(total_amount) OVER (
PARTITION BY customer_id
ORDER BY order_date
ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW
) AS running_total
FROM orders;
CREATE PROCEDURE GetCustomerOrders
@CustomerId INT,
@StartDate DATE = NULL,
@EndDate DATE = NULL
AS
BEGIN
SET NOCOUNT ON;
SELECT
order_id,
order_date,
total_amount
FROM orders
WHERE customer_id = @CustomerId
AND (@StartDate IS NULL OR order_date >= @StartDate)
AND (@EndDate IS NULL OR order_date <= @EndDate)
ORDER BY order_date DESC;
END;
-- Call it: EXEC GetCustomerOrders @CustomerId = 101, @StartDate = '2026-01-01';
MERGE INTO customers AS target
USING staging_customers AS source
ON target.customer_id = source.customer_id
WHEN MATCHED THEN
UPDATE SET
target.customer_name = source.customer_name,
target.email = source.email,
target.updated_at = GETDATE()
WHEN NOT MATCHED THEN
INSERT (customer_id, customer_name, email, created_at)
VALUES (source.customer_id, source.customer_name, source.email, GETDATE());
#FACC15
rgb(250, 204, 21)
rgb(98%, 80%, 8%)
hsl(46, 96%, 53%)
hsv(46, 92%, 98%)
cmyk(0%, 18%, 92%, 2%)
Color Picker & Converter — HEX to RGB, HSL, HSV & CMYK
The Color Picker lets you pick any color and instantly get it in every common format — HEX, RGB, RGB percentage, HSL, HSV, and CMYK. It's built for developers and designers who need a hex to rgb converter while writing CSS, or who want to check a color's HSL values for a design system. Pick a color from the swatch, or type a HEX or RGB value directly, and every format updates live.
⚡ Key Takeaways
- One color, six formats at once: HEX, RGB, RGB%, HSL, HSV, CMYK.
- Pick visually with the native color swatch, or type exact HEX/RGB values.
- CMYK conversion is a standard approximation, not a print-calibrated value.
- HSL makes it easy to generate consistent lighter/darker shades of one base color.
What, Who, When & Why
| What it's for | Picks a color and instantly converts it to HEX, RGB, RGB%, HSL, HSV, and CMYK. |
|---|---|
| Who it's for | Developers writing CSS and designers matching colors across digital and print formats. |
| When to use it | Whenever you need a color in a different format than the one you have — like a HEX code for CSS but need CMYK for print. |
| Why it's needed | Manually calculating color format conversions is impractical, and using inconsistent color formats across a project causes visual mismatches. |
| Best way to use it | Use HSL when you need to programmatically create lighter or darker shades of the same base color. |
How to Use the Color Picker
- Click the color swatch to open your browser's native color picker, or type a HEX code directly into the HEX field.
- Alternatively, type exact Red, Green, and Blue values into the R, G, B number fields.
- Every format — HEX, RGB, RGB%, HSL, HSV, and CMYK — updates instantly as you adjust the color.
- Click Copy on any format's card to copy that specific value to your clipboard.
How the Conversions Work
Each color format represents the same color using different variables:
- HEX — a 6-digit hexadecimal code representing red, green, and blue in base 16, e.g.
#FACC15. - RGB — red, green, and blue values from 0–255, e.g.
rgb(250, 204, 21). - HSL — Hue (0–360°), Saturation (0–100%), and Lightness (0–100%), which is often more intuitive for adjusting a color's brightness or intensity.
- HSV/HSB — Hue, Saturation, and Value/Brightness, commonly used in design software color pickers.
- CMYK — Cyan, Magenta, Yellow, and Key (black) percentages, used primarily for print design.
Example
A golden-yellow color with HEX code #FACC15 converts to:
| Format | Value |
|---|---|
| RGB | rgb(250, 204, 21) |
| HSL | hsl(46, 96%, 53%) |
| HSV | hsv(46, 92%, 98%) |
| CMYK | cmyk(0%, 18%, 92%, 2%) |
Typing a different HEX code, or dragging the native color picker to a new shade, instantly recalculates every other format at once — there's no need to convert one format at a time or switch between separate tools for each conversion.
Key Features
- Native color picker swatch alongside manual HEX and RGB input.
- Six simultaneous output formats: HEX, RGB, RGB%, HSL, HSV, CMYK.
- Live preview swatch showing the exact selected color.
- One-click copy on every individual format.
- All conversion math runs locally — no color values are sent anywhere.
Practical Use Cases
- Writing CSS: convert a designer-provided HEX code into HSL for easier programmatic lightness/darkness adjustments.
- Matching brand colors: confirm a color's exact RGB or CMYK values for print materials versus digital use.
- Design handoff: quickly translate between formats when a design tool and a codebase expect different color formats.
- Accessibility checks: reference RGB values while manually verifying contrast ratios.
- Building a color palette: check HSL values across several colors to confirm consistent saturation or lightness for a cohesive design system.
Tips for Best Results
- Use HSL when you need to programmatically create lighter or darker variants of a base color, since adjusting Lightness alone keeps the hue and saturation consistent.
- Double-check CMYK values against your actual print vendor's color profile before finalizing print materials, since this is a general approximation.
- Copy the HEX value first when working in CSS, since it's the most universally supported format across browsers and design tools.
Related Terminology
Hue refers to the base color itself (red, blue, green, etc.), represented as a position on a 360° color wheel. Saturation describes how intense or muted a color is, while Lightness (in HSL) or Value (in HSV) describes how close the color is to white or black. CMYK is a subtractive color model used in printing, while RGB and HSL/HSV are additive models used for screens.
Important Considerations
CMYK conversion from RGB is an approximation — professional print workflows typically use color profiles (ICC profiles) calibrated to specific printers and paper stocks for accurate results, so treat the CMYK values here as a general reference rather than a print-ready spec.
Related Tools
Sketching out a UI layout? Try the Flow Planner for diagramming, where you can also pick colors for shapes. If you're organizing color references alongside notes, Sticky Notes also includes a color palette for organizing by category.
Frequently Asked Questions
How do I convert a HEX color to RGB?
Type or paste the HEX code into the HEX field — the RGB value (along with HSL, HSV, and CMYK) updates automatically.
Can I type exact RGB values instead of using the color picker?
Yes, use the R, G, and B number fields to enter exact values from 0–255 for each channel.
Is the CMYK conversion accurate for professional printing?
It's a standard mathematical approximation from RGB, which is a reasonable reference, but professional print work should use color-profile-calibrated conversions specific to the printer and paper being used.
What's the difference between HSL and HSV?
Both use Hue and Saturation, but HSL uses Lightness (how close to white or black) while HSV uses Value/Brightness (how close to full brightness) — they describe the same color space slightly differently and are used in different design tools.
Why would I use HSL instead of HEX in CSS?
HSL makes it easy to create consistent lighter or darker shades of the same color by adjusting only the Lightness value, which is harder to do predictably with HEX or RGB.
Tools for analysts, developers & QA engineers
33 free, browser-based utilities — text and list tools, SQL helpers, converters, and small productivity apps. Everything runs locally; nothing you type or paste is ever uploaded.
For Analysts
Clean lists, build SQL fragments, and reshape data without opening a spreadsheet.
For Developers
Format SQL, convert data formats, and handle everyday text and encoding tasks.
For QA Engineers
Generate test data, compare text output, and sanitize queries before sharing them.