The filter: hue-rotate() function rotates the hue of every pixel in an element along the HSL colour wheel by a specified angle value, leaving saturation and lightness unchanged while shifting the chromatic component uniformly.
Loading Filter Effects Builder…
Live hue rotation preview across the full 0 to 360 degree range
Visualise colour wheel position for any input colour
Combine hue-rotate with saturate for vivid recolouring
Generate animated hue cycling CSS with keyframe output
Drop the Filter Effects Builder into any page — blog post, product docs, intranet, school portal — with a single line of HTML. Your visitors get the full tool, processed entirely in their browser. No backend, no uploads, no signup.
Embed code
<iframe
src="https://www.fixtools.io/css-tool/filter-effects-builder?embed=1"
width="100%"
height="780"
frameborder="0"
style="border:0;border-radius:16px;max-width:900px;"
title="Filter Effects Builder by FixTools"
loading="lazy"
allow="clipboard-write"
></iframe>Attribution-friendly: a small "Powered by FixTools" link appears in the embed footer.
The hue-rotate() function accepts an angle value where deg, rad, turn, and grad are all valid units, though in practice deg is universal in production code because most colour wheel references and design tools use degrees. The rotation is applied in the HSL colour model: the hue component of every pixel shifts by the specified angle while saturation and lightness remain unchanged. A pixel at hue 0 (red) rotated by 120deg becomes hue 120 (green). A pixel at hue 200 (blue) rotated by 120deg becomes hue 320 (magenta). Because all pixels shift by the same angle, the relative hue relationships between colours in the element are preserved. A multicolour illustration rotated by 90deg still contains the same variety of colours, but all shifted 90 degrees around the wheel, which keeps the original colour harmony intact.
SVG icon recolouring is one of the most practical uses of hue-rotate() in production codebases. A single SVG icon file using a specific fill colour can be shifted to any other hue by calculating the degree difference between the source hue and the target hue in the HSL model and using that difference as the hue-rotate() value. For a blue icon at approximately 210deg hue that should appear green at approximately 120deg hue, the rotation is 360 + 120 - 210 = 270deg, or equivalently -90deg. This calculation eliminates the need for separate coloured icon assets or SVG use elements with different CSS variables, particularly useful for icon libraries with many colour variants where shipping duplicate asset files for each colour would be expensive and tedious to maintain over time.
Animating hue-rotate() creates a continuous colour cycling effect that is popular for hero accents and decorative elements. A @keyframes block from hue-rotate(0deg) to hue-rotate(360deg) with animation-iteration-count: infinite and animation-timing-function: linear produces a smooth, constant colour cycle. Applied to a gradient background, logo mark, or decorative illustration, this creates the rainbow shift effect seen on many modern SaaS landing pages and personal portfolio sites. The computational cost is low because hue-rotate() is a per pixel matrix operation without spatial sampling, similar in cost to sepia() and grayscale(). Combining hue-rotate with saturate(1.2) in the same filter declaration keeps the colours vivid throughout the cycle, preventing them from looking washed out at hue positions that map to less saturated rendered colours due to display gamut limitations.
hue-rotate() interacts with other filter functions in order dependent ways worth understanding when building complex stacks. Applying sepia() before hue-rotate() first warms the image to a brown monochrome and then shifts the entire result around the colour wheel, producing a tinted monochrome in any chosen hue: sepia(1) hue-rotate(120deg) produces a green tinted monochrome, sepia(1) hue-rotate(240deg) produces a blue tinted monochrome. Reversing the order changes the result because hue-rotate() applied first to a coloured image alters the input that sepia() then receives, which produces a different mapping. Use the visual builder to drag function rows and compare orderings side by side instead of editing CSS by hand, which is significantly faster when exploring tinted monochrome variations across an icon set or photographic content.
Drag the hue-rotate slider through the degree range and observe all colours in the preview shift together along the colour wheel. Stop at any degree value where the colour output matches your target and copy the filter declaration.
Step-by-step guide to css hue rotate filter generator:
Add hue-rotate() to the filter builder
Select hue-rotate from the function panel using the Add Filter dropdown. The preview starts at 0deg, the identity value, with no visible change to the element colours. This baseline lets you compare every subsequent slider position directly against the unfiltered original without needing to mentally reset between adjustments while you explore the colour wheel.
Drag the degree slider
Move the slider through the 0 to 360 degree range and observe every coloured pixel in the preview shifting together around the colour wheel in real time. Pause at the target colour output and read the exact degree value from the field beside the slider. Type a precise number directly if you already know the rotation angle you need from a previous calculation.
Stack saturate() or other functions
Add saturate(1.1) to maintain colour vividness across the full hue range, since some hue positions can render less saturated on certain displays. Add sepia(1) before hue-rotate() to tint an otherwise achromatic element, or stack brightness() afterwards to fine tune luminance. Adjust function order by dragging rows to change the final rendered result.
Copy and apply to your element
Click Copy CSS to copy the filter declaration including every function in the current stack. For animated colour cycling, wrap the rule in a @keyframes block from hue-rotate(0deg) to hue-rotate(360deg) with linear timing and infinite iteration count. The visual builder shows a preview of the animation so you can confirm the cycle speed before pasting the CSS into your stylesheet.
Common situations where this approach makes a real difference:
SVG icon colour variants from a single file
A design system has a single set of SVG icons in the primary blue brand colour. The system needs red, green, and amber icon variants for status indicators across the dashboard product. Rather than creating separate coloured SVG files for every status and every icon, a developer calculates the hue difference from the source blue to each target colour and applies filter: hue-rotate(Xdeg) to dedicated status icon classes. Three CSS rules replace what would otherwise require dozens of additional SVG files that designers would have to update each time the base icon set changed, making the system far easier to maintain.
Rainbow gradient cycling on a landing page logo mark
A SaaS product launch page uses an SVG logo mark with a coloured gradient fill to convey product energy on the hero. The developer wants the logo to cycle through colours as a subtle but distinctive visual accent that loops indefinitely while the visitor remains on the page. They apply filter: hue-rotate(0deg) saturate(1.15) at rest and add an animation cycling from hue-rotate(0deg) to hue-rotate(360deg) over six seconds with linear timing and infinite iteration count. The saturate addition keeps colours vivid throughout the cycle on monitors with narrower colour gamuts where some hue positions can otherwise look muted compared to the source colours.
Hover complementary colour flip on a call-to-action button
A marketing team wants the primary CTA button to flip to its complementary colour on hover as a visual hook that draws attention without changing the button position or content layout. A developer applies filter: hue-rotate(0deg) at rest and filter: hue-rotate(180deg) on :hover with transition: filter 0.3s ease applied to the base rule. The 180 degree rotation produces the exact complementary colour for any brand palette without needing a second colour variable, custom property override, or modifier class. The single transition value covers every button on the site that shares the class, keeping the implementation small.
CSS-only colour theme switcher prototype
A developer prototyping a theme switcher for a web app applies filter: hue-rotate(var(--theme-hue)) to the main content wrapper element. A range input slider in the developer console controls --theme-hue via a JavaScript event listener that updates the CSS custom property on the documentElement. All coloured elements on the page shift simultaneously across the whole layout, giving a realistic preview of the entire UI in any hue variant without maintaining separate theme stylesheets or duplicate component rule blocks. The prototype is sufficient for stakeholder review meetings where direction must be chosen before committing real theme values to the design system.
Get better results with these expert suggestions:
Use hue-rotate on a CSS gradient for a live colour theme preview
Apply filter: hue-rotate() to a container with a CSS gradient background. Changing the degree value from a range input via JavaScript instantly previews the gradient in any hue variant without recomputing the underlying gradient colour stops manually. This is a fast prototyping technique for exploring brand colour palettes against a real layout, especially when stakeholders want to see the same composition in multiple colour directions during a design review. Once a target hue is agreed, the developer can hardcode the equivalent gradient colours and remove the filter to ship cleaner production CSS.
hue-rotate() does not affect achromatic colours
Pure black, white, and grey have no hue component in the HSL model because their saturation is zero, so the colour wheel rotation has nothing to act on. hue-rotate() does not change these pixels regardless of the degree value supplied. An element that is entirely greyscale will look identical at any hue-rotate() value, which is a common source of confusion when developers first apply hue-rotate to a monochrome SVG icon and see no change. Combine with sepia() or another tinting function before hue-rotate() in the filter stack if you want the rotation to affect achromatic source content.
Scope hue-rotate to a container for site-wide theme switching
Applying filter: hue-rotate(var(--theme-hue, 0deg)) to the body or a main content wrapper and changing --theme-hue via JavaScript creates a site wide colour theme toggle driven from a single CSS variable update. All images, icons, and coloured elements shift together in lockstep, producing a consistent theme preview without maintaining multiple colour theme stylesheets or duplicating component rules. This is excellent for prototype phases when stakeholders are still choosing a final brand hue, though for production it is usually better to commit to specific colour values rather than rely on filter based theming because the filter affects every coloured pixel uniformly.
Layer hue-rotate with grayscale for coloured monochrome effects
filter: grayscale(1) hue-rotate(Xdeg) does not produce coloured output because grayscale removes all hue information before hue-rotate operates on the pixels downstream in the filter chain. For a tinted monochrome effect, use sepia(1) first to introduce a warm hue, then hue-rotate() to shift that hue to the target colour: filter: sepia(1) hue-rotate(90deg) produces a green tinted monochrome, sepia(1) hue-rotate(200deg) produces a cool blue tinted monochrome, and sepia(1) hue-rotate(300deg) produces a magenta tinted monochrome. This is the standard CSS technique for any tinted monochrome treatment when the source content includes coloured imagery.
Calculate the hue difference to target a specific colour
Find the HSL hue of the source colour and the target colour. Subtract the source hue from the target hue, wrapping negative values by adding 360. Use this difference as the hue-rotate() degree value. This gives you a specific recolour rather than a trial-and-error rotation.
Use hue-rotate(180deg) for complementary colour effects
A 180-degree rotation shifts every colour to its complementary hue on the colour wheel. Applied to a logo or icon, this produces a complementary colour version without creating a separate asset. Combine with a CSS transition for a hover effect that flips between primary and complementary brand colours.
Add saturate(1.1) to maintain vividness during hue cycling
Some hue positions appear less saturated on screen due to monitor colour profiles and rendering differences. Pairing filter: hue-rotate() with saturate(1.1) compensates for this, keeping colours evenly vivid throughout a full cycle animation.
More use-case guides for the same tool:
Other tools you might find useful:
Open the full Filter Effects Builder — free, no account needed, works on any device.
Open Filter Effects Builder →Free · No account needed · Works on any device