Sass Functions

Beginner
121 Tutorials
Updated: Nov 2026

What You’ll Learn

Sass ships built-in modules of functions. Load one with @use "sass:math" (or color, list, map, meta, selector, string) and call its functions with the module name as a prefix.

SCSS
@use "sass:math";
@use "sass:map";
@use "sass:string";

$sizes: (sm: 480px, md: 768px);

.box {
  width: math.div(100%, 3);
  max-width: map.get($sizes, md);
  content: string.to-upper-case("hello");
}

Function Index

Math Functions

Numbers, rounding, trigonometry, and constants.

Color Functions

Read, adjust, mix, and convert colors.

color.adjust()Tutorial

Shift Channels by Fixed Amounts

adjust-hue()Tutorial

Deprecated — Use color.adjust

color.alpha()Tutorial

Read Opacity 0–1 — Prefer color.channel

color.blackness()Tutorial

HWB Blackness 0%–100% — Prefer color.channel

color.blue()Tutorial

RGB Blue 0–255 — Prefer color.channel

color.change()Tutorial

Set Channels to Exact Values

color.channel()Tutorial

Read One Channel as a Number

color.complement()Tutorial

Rotate Hue 180deg

darken()Tutorial

Deprecated — Prefer color.scale / color.adjust

desaturate()Tutorial

Deprecated — Prefer color.scale / color.adjust

fade-in()Tutorial

Deprecated — Prefer color.scale / color.adjust

fade-out()Tutorial

Deprecated — Prefer color.scale / color.adjust

color.grayscale()Tutorial

Mute to Gray, Keep Lightness

color.green()Tutorial

RGB Green 0–255 — Prefer color.channel

color.hue()Tutorial

HSL Hue 0deg–360deg — Prefer color.channel

color.ie-hex-str()Tutorial

#AARRGGBB for Legacy IE Filters

color.invert()Tutorial

Negative / Inverse Colors

color.is-legacy()Tutorial

Detect rgb / hsl / hwb Spaces

color.is-missing()Tutorial

Detect none Channels

color.is-powerless()Tutorial

Hue That Doesn’t Affect Look

lighten()Tutorial

Deprecated — Prefer color.scale / color.adjust

color.lightness()Tutorial

HSL Lightness 0%–100% — Prefer color.channel

color.mix()Tutorial

Blend Two Colors with Weight

opacify()Tutorial

Deprecated — Prefer color.scale / color.adjust

color.opacity()Tutorial

Read Alpha 0–1 — Prefer color.channel

color.red()Tutorial

RGB Red 0–255 — Prefer color.channel

rgb()Tutorial

Build RGB Colors — Global Constructor

rgba()Tutorial

RGB + Alpha — Global Constructor

color.same()Tutorial

Visual Equality Across Spaces

saturate()Tutorial

Deprecated — Prefer color.scale / color.adjust

color.saturation()Tutorial

HSL Saturation 0%–100% — Prefer color.channel

color.scale()Tutorial

Fluid Channel Scaling Toward Min/Max

color.space()Tutorial

Read a Color’s Space Name

color.to-gamut()Tutorial

Map Colors Into a Target Gamut

color.to-space()Tutorial

Convert Between Color Spaces

transparentize()Tutorial

Deprecated — Prefer color.scale / color.adjust

color.whiteness()Tutorial

HWB Whiteness 0%–100% — Prefer color.channel

List Functions

Build and inspect lists.

Map Functions

Read, merge, and update maps.

Meta Functions

Introspect values, call functions and mixins, and work with modules.

Selector Functions

Work with selectors as values.

String Functions

Slice, search, and transform strings.

Frequently Asked Questions

Add @use "sass:math" (or another module) at the top of your file, then call functions like math.div() with the module name as a prefix.
No. Prefer the module versions and newer color functions. Many global functions are deprecated.
Sass functions run at compile time and return values. CSS functions like calc() or var() can stay in the output for the browser to evaluate.
Start with math, then map and list. Meta functions come after you are comfortable with mixins and functions.
Open math.abs() and work through the Math section, then the section you need most.

Next: Sass math.abs Function

Start with the first tutorial in this section.

Continue →

CODETOFUN NEWS

Stay Ahead in Tech

Get the latest IT news, programming updates, and technology trends directly on your phone.

Your daily dose of tech, straight to your feed.

About the author

Mari Selvan M P
Mari Selvan M P 🔗

Developer, cloud engineer, and technical writer

  • Experience 12 years building web and cloud systems
  • Focus Full Stack Development, AWS, and Developer Education

I write practical tutorials so students and working developers can learn by doing—from databases and APIs to deployment on AWS.

6 people found this page helpful