Favorites

CSS <hue> Data Type

<hue>
CSS Data TypeThis data type is supported by all modern browsers.
Updated 21st November 2026

The <hue> data type is the angle of a color around the color wheel, written as a number or angle, as used by hsl(), hwb(), lch() and oklch().

Looks like you're using an ad blocker, and that's fine! Ads help keep CSS Portal's generators and references free, so if the site's useful to you, visit our Support page to see other ways to help.

Description

The <hue> CSS data type represents the hue angle of a color: its position around a color wheel. It is used as a component in color functions that describe colors with a hue, including hsl(), hwb(), lch() and oklch(). Changing only the hue while keeping the other components the same lets you move from red through yellow, green, cyan, blue and magenta and back to red again.

A <hue> can be written as an <angle>, such as 120deg, 0.5turn or 3.1416rad, or as a plain <number>, which is treated as degrees. Because it is an angle, the value wraps around: 360deg is the same as 0deg, 480deg is the same as 120deg, and negative values count backwards, so -60deg equals 300deg. In hsl() and hwb(), 0deg is red, 120deg is green and 240deg is blue. In lch() and oklch() the same angles produce slightly different colors, because those color spaces are arranged by how humans perceive color.

In the modern space-separated color syntax, the hue can also be the keyword none, which means the hue is missing. This is useful for grays and when mixing colors. Hue also matters when colors are interpolated, for example in gradients and color-mix(), where hue interpolation methods (shorter, longer, increasing and decreasing) control which way around the wheel the transition travels.

Examples:

/* Hue as a plain number (degrees) */
.green {
  color: hsl(120 100% 35%);
}

/* Hue as an angle in turns */
.cyan {
  background-color: hsl(0.5turn 80% 50%);
}

/* Hue in a perceptual color space */
.brand {
  background-color: oklch(65% 0.2 250deg);
}

/* Rainbow gradient travelling the long way around the wheel */
.rainbow {
  background: linear-gradient(to right in hsl longer hue, red, red);
}

Because hue is a single number, it is easy to animate or calculate with custom properties, which makes it ideal for building color themes from one base hue.

Interactive Demo

Colour swatch
Demo Code
HTML Code
<div class="demo-element">Colour swatch</div>
CSS Code
.demo-element {
	width: 260px;
	padding: 18px;
	border-radius: 8px;
	font-size: 16px;
	font-weight: bold;
	color: #fff;
	text-shadow: 0 1px 2px rgb(0 0 0 / 40%);
	background: hsl(0 85% 55%);
}

Syntax

<hue> = <number> | <angle>

Values

  • <number>A plain number, interpreted as an angle in degrees. For example, 240 is the same as 240deg.
  • <angle>An angle using deg, grad, rad or turn units. Refer to <angle> for possible values. Values outside 0deg to 360deg wrap around the color wheel.

Example

<div class="wrap">
<h1>CSS &lt;hue&gt; examples</h1>
<div class="row">
<div class="chip h0">0</div>
<div class="chip h60">60deg</div>
<div class="chip h120">120</div>
<div class="chip h180">0.5turn</div>
<div class="chip h240">240deg</div>
<div class="chip h300">-60deg</div>
</div>
<div class="wheel"></div>
<p class="note">The full hue wheel, from 0deg to 360deg.</p>
</div>
/* Demonstrates  values in hsl() */
* { box-sizing: border-box; }

body {
  margin: 24px;
  font-family: system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial;
  background: #f8fafc;
  color: #0f172a;
}

.wrap {
  max-width: 860px;
  margin: 0 auto;
}

h1 {
  font-size: 20px;
  margin: 0 0 16px;
}

.row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 12px;
}

.chip {
  height: 90px;
  border-radius: 10px;
  display: flex;
  align-items: flex-end;
  padding: 8px;
  color: #fff;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, monospace;
  font-size: 12px;
  font-weight: 700;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
}

.h0 { background: hsl(0 85% 55%); }
.h60 { background: hsl(60deg 85% 45%); }
.h120 { background: hsl(120 70% 40%); }
.h180 { background: hsl(0.5turn 80% 40%); }
.h240 { background: hsl(240deg 75% 55%); }
.h300 { background: hsl(-60deg 70% 50%); }

.wheel {
  width: 180px;
  height: 180px;
  margin: 24px auto 0;
  border-radius: 50%;
  background: conic-gradient(
    hsl(0 90% 55%), hsl(60 90% 55%), hsl(120 90% 55%),
    hsl(180 90% 55%), hsl(240 90% 55%), hsl(300 90% 55%), hsl(360 90% 55%)
  );
}

.note {
  text-align: center;
  font-size: 13px;
  color: #475569;
}
Open in editor

Browser Support

The following information will show you the current browser support for the CSS hue data type. Hover over a browser icon to see the version that first introduced support for this CSS data type.

This data type is supported by all modern browsers.

Desktop

Chrome
Edge
Firefox
Opera
Safari

Tablets & Mobile

Chrome Android
Firefox Android
Opera Android
Safari iOS
Samsung Internet
Android WebView
-
Supported Unknown Not supported

Looks like you're using an ad blocker, and that's fine! Ads help keep CSS Portal's generators and references free, so if the site's useful to you, visit our Support page to see other ways to help.