Sass Introduction

Beginner
6 min read
Updated: Oct 2026
CSS preprocessor

What Is Sass?

Sass (Syntactically Awesome Style Sheets) is a CSS preprocessor. You write Sass or SCSS source files; a compiler turns them into standard CSS that browsers load as usual.

Remember
Author →  styles.scss  (variables, nesting, mixins)
Compile →  styles.css   (plain CSS for the browser)

Two syntaxes:
  .scss  →  SCSS (CSS-compatible; most common)
  .sass  →  indented Sass (no braces)

Prefer @use over legacy @import in new projects

Any valid CSS file is valid SCSS. Learn CSS first—Sass extends it with variables, nesting, mixins, and modules so large stylesheets stay organized.

Why Use Sass?

Plain CSS works, but repeating colors and deep selectors gets messy. Sass adds structure without changing what the browser understands.

NeedHow Sass helps
Reuse valuesVariables like $primary-color
Readable selectorsNest rules instead of repeating parents
Share patternsMixins and @extend / placeholders
Split filesPartials and @use modules

How Sass Becomes CSS

Browsers never run SCSS—only the compiled CSS ships:

StepWhat happens
1. WriteYou author .scss (or .sass) with Sass features
2. CompileDart Sass or a bundler expands variables, nesting, and mixins
3. OutputA plain .css file (optionally minified / sourcemapped)
4. ServeHTML links the CSS; the browser styles the page

Your First SCSS File

Variables plus nesting—then compile to CSS:

SCSS
$primary-color: #333;

body {
  font: 100% Helvetica, sans-serif;
  color: $primary-color;
}

nav {
  ul {
    margin: 0;
    padding: 0;
    list-style: none;
  }

  li { display: inline-block; }

  a {
    display: block;
    padding: 6px 12px;
    text-decoration: none;
  }
}
terminal
sass styles.scss styles.css
CSS
body {
  font: 100% Helvetica, sans-serif;
  color: #333;
}

nav ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

nav li {
  display: inline-block;
}

nav a {
  display: block;
  padding: 6px 12px;
  text-decoration: none;
}

How It Works

1. Variable. $primary-color stores a value you reuse.

2. Nesting. Rules inside nav compile to nav ul, nav a, and so on.

3. Compile. sass (or Vite / Webpack) emits plain CSS for production.

Next, set up the toolchain in Sass Installation.

Sass vs Plain CSS

Sass is a super-set workflow—CSS is still the deliverable:

Sass / SCSSPlain CSS
Authoring language + compilerWhat the browser loads
Variables, nesting, mixins, modulesNative custom properties & nesting (newer)
Needs a build step for .scssCan ship without a preprocessor
Great for large design systemsFine for small pages and prototypes

When to use which

Use Sass when…Prefer plain CSS when…
You share tokens, mixins, and many partialsThe project is tiny or build-free
The team already has a Sass design systemYou only need modern CSS features
You maintain a large legacy SCSS codebaseYou want zero compile tooling

Core Building Blocks

These features show up in almost every Sass project:

FeatureWhat it doesExample
VariablesStore reusable values$gap: 1rem;
NestingNest selectors to match HTMLnav { a { } }
PartialsSplit styles into _file.scss@use "variables";
MixinsReusable chunks of CSS@include flex-center;
OperatorsMath on numbers and colorswidth: 100% / 3;
FunctionsBuilt-in color/string/math helperslighten($c, 10%)

Where Is Sass Used?

Sass still powers many front-end stacks:

Use caseWhy Sass fits
Design systemsShared tokens, mixins, and theme maps
Component librariesPartials per component, consistent spacing
Responsive layoutsBreakpoint mixins and fluid math
Legacy appsLarge SCSS codebases still in production
Framework themesBootstrap and others ship Sass sources
Static sitesCompile once, ship plain CSS

Key Takeaways

  • Sass is a preprocessor—browsers only see CSS.
  • SCSS is the usual syntax; any CSS is valid SCSS.
  • Core tools: variables, nesting, mixins, and @use.
  • Learn CSS first—Sass organizes it; it does not replace it.

One line: Sass writes smarter CSS—next, install the compiler.

Frequently Asked Questions

Sass (Syntactically Awesome Style Sheets) is a CSS preprocessor. You write Sass or SCSS source files, a compiler converts them to standard CSS, and browsers load the CSS as usual.
Sass originally used indented syntax (.sass files, no braces). SCSS (.scss) uses CSS-like braces and semicolons and is fully compatible with CSS. Most teams use SCSS today.
Yes. Sass extends CSS—it does not replace understanding selectors, the box model, flexbox, or the cascade. Learn CSS fundamentals first, then Sass helps you organize and reuse styles.
Yes. Sass remains popular in legacy codebases and many design systems. New projects also use PostCSS, CSS custom properties, and native nesting, but Sass skills transfer widely and compile to plain CSS.
Install Dart Sass (npm install -g sass or use the standalone binary), then run sass input.scss output.css. Build tools like Vite, Webpack, and Parcel compile SCSS automatically.
Follow the Installation guide, then practice variables, nesting, partials, mixins, and functions. Learn @use modules, responsive mixins, and how to structure a multi-file design system.

Did you know?

Write SCSS in .scss files (CSS-compatible syntax). Compile to CSS with sass styles.scss styles.css or your build tool. Prefer @use over legacy @import in new projects.

Next: Sass Installation

Install the compiler and turn SCSS into CSS on your machine.

Installation →

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.

10 people found this page helpful