Are you using SCSS as a CSS preprocessor in your project? No problemo, Font Awesome has an SCSS version if you'd prefer to import our styling into your workflow.

We’ll cover the basics of picking the SCSS files you’ll need for your project, adding Font Awesome to your compile, inject code into a class with Mixins, and more.

Before You Get Started

Make sure you...

Get Set Up

You'll find everything you need in the fontawesome6 directory of the Font Awesome download. Below is the list of files made specifically for SCSS. You can add them all to your project or pick just the ones you need.

Files What They Do
fontawesome.scss Main Font Awesome compile
brands.scss Brand icon styles
solid.scss Solid icon styles
regular.scss Regular icon styles
light.scss Light icon styles
thin.scss Thin icon styles
sharp-solid.scss Sharp Solid icon styles
duotone.scss Duotone icon styles
_duotone-icons.scss Duotone icon classes
_variables.scss Where variables are defined that are used throughout styling
_mixins.scss Utilities used throughout styling/icon definitions
_core.scss Base icon reference class syntax and definition
_sizing.scss icon sizing support styling
_fixed-width.scss fixed-width icon support styling
_list.scss icons in a list support styling
_bordered-pulled.scss bordered + pulled icon support styling
_animated.scss animated icon support styling
_rotated-flipped.scss rotating icons support styling
_stacked.scss stacking icons support styling
_icons.scss All icon definitions
_screen-reader.scss screen-reader specific and accessibility support styling

Compatibility

Font Awesome's SCSS can be compiled with Sass (opens new window) and Dart Sass (opens new window). We tend to stick to the latest versions of both compilers when possible. While you may also compile using node-sass (opens new window) and libsass (opens new window), be aware that those implementations are officially deprecated (opens new window) and are not actively supported.

Adding Font Awesome to Your Compile

Copy the scss folder into your project. Then copy the entire webfonts folder into your project, where your static files get served.

Open your project's scss/variables.scss and edit the $fa-font-path variable to point to where you placed the webfonts folder.

$fa-font-path: "../webfonts";

In your main SCSS compile file, import Font Awesome by adding the core styles file, @import "scss/fontawesome.scss". Then import one or more styles.

Here's a simple example:

// importing core styling file
@import "./fontawesome/scss/fontawesome.scss";

// our project needs Solid + Brands
@import "./fontawesome/scss/solid.scss";
@import "./fontawesome/scss/brands.scss";

If you wanted to use more styles, add more style imports:

// importing core styling file
@import "./fontawesome/scss/fontawesome.scss";

// our project needs Classic Solid, Brands, and Sharp Solid 
@import "./fontawesome/scss/solid.scss";
@import "./fontawesome/scss/brands.scss";
@import "./fontawesome/scss/sharp-solid.scss";

Using Duotone Icons

If a project uses Duotone icons, you'll need to @import two separate files.

// importing core styling file
@import "./fontawesome/scss/fontawesome.scss";

// our project needs Duotone - which requires both of the following files
@import "./fontawesome/scss/duotone.scss";
@import "./fontawesome/scss/_duotone-icons.scss";

Ch-chigity Check Your Paths!

Make sure the font path and your webfonts directory are relative to where your compiled CSS will be located.

Autoprefixer is not included in v6!

For the sake of not being too prescriptive, we've removed Autoprefixer (opens new window) from our compile and build steps. If your project needs it, you'll need to add it yourself.

Adding Icons

Once you've added the imports above and have your compiled CSS that includes Font Awesome set up and referenced in your project, you can add icons to your project's HTML.

Here's an example of how to reference icons with your compiled and hosted CSS:

<head>
  <!--load your compiled CSS (including Font Awesome) -->
  <link href="/your-path-to-your-compiled-css-including-fontawesome/file.css" rel="stylesheet">
</head>
<body>
  <!-- This example uses <i> element with: 
  1. the `fa-solid` style class for solid style
  2. the `user` icon with the `fa-` prefix -->
  <i class="fa-solid fa-user"></i>

  <!-- Or you can use a <span> element, with classes applied in the same way -->
  <span class="fa-solid fa-user"></span>
</body>

SCSS Customizations at Your Command

Any changes to the Font Awesome SCSS variables (e.g. changing the fa- prefix or our sizing scales), will take effect in your project's compiled CSS.

Custom SCSS-based CSS Rules

If you want to use any of our SCSS mixins or utilities, you can leverage our CSS Pseudo-elements method of adding icons to your project to do. This method is also useful when changing the HTML on your project is not an option.

Using our @include fa-icon- and @include fa-family- mixins, you can easily generate custom CSS Pseudo-element rules with CSS selectors specific to your project.

// Solid style of user
.user {
  @include fa-icon-solid($fa-var-user);
}

// Regular style of triangle-exclamation
.triangle-exclamation {
  @include fa-icon-regular($fa-var-triangle-exclamation);
}

// Light style of newspaper
.newspaper {
  @include fa-icon-light($fa-var-newspaper);
}

// Thin style of paintbrush-fine
.paintbrush-fine {
  @include fa-icon-thin($fa-var-paintbrush-fine);
}

// Duotone style of camera-retro
.camera-retro {
  @include fa-icon-duotone($fa-var-camera-retro);
}

// Twitter brand icon
.twitter {
  @include fa-icon-brands($fa-var-twitter);
}

// Sharp Solid style of trash
.trash {
  @include fa-icon-solid($fa-var-trash);
  @include fa-family-sharp(); // define Sharp family
}

// Classic Solid style of trash
.trash {
  @include fa-icon-solid($fa-var-trash);
  @include fa-family-classic(); // explicity setting Classic family (optional since this is Font Awesome's default)
}

Style Mixins

To use the style mixins, you'll want to:

  1. Choose the right mixin for your desired style.
  2. Pass in the SCSS variable for the icon you want to display.
Style Mixin Availability What Style Renders
fa-icon-brands() Free Plan Brands
fa-icon-solid() Free Plan Solid
fa-icon-regular() Pro only Regular
fa-icon-light() Pro only Light
fa-icon-thin() Pro only Thin
fa-icon-duotone() Pro only Duotone

Style Mixins Include Set Up Styles Too!

These style mixins also handle the basic rendering styles that we bundle in our toolkit to make sure icons display perfectly in their context and in browsers.

Family Mixins

If you're using our mixins to render an icon in a specific family, like our Sharp family of styles, you'll need to reference the right family mixin (e.g. @include fa-family-sharp). Classic is our default family of styles, so there's no need to set it with a family mixin unless you're trying to explicitly set to override a previous family.

Family Mixin Availability What Style Renders
fa-family-classic() Free Plan Classic when used with other style mixins
fa-family-sharp() Pro only Sharp when used with other style mixins

A More Manual Custom CSS Approach

If you'd rather a more customizable approach when right your styling rules, we've made the utilties used in the style mixins available to get the same rendering results.

To write manual rules, you'll want to:

  1. Get the core set up styling of icons by adding @extend %fa-icon;
  2. Use @extend .fa-solid; to include the styling to render the icon in the Solid style (similar syntax for other styles)
  3. Use @extend .fa-classic; or @extend .fa-sharp; to include the styling to render the icon in a specific family (Classic is set by default)
  4. Use fa-content and variable names to make including an icon's Unicode values a little easier. This is similar in syntax to adding icons via pseudo-elements
// Solid style of user
.user {
  @extend %fa-icon;
  @extend .fa-solid;

  &:before {
    content: fa-content($fa-var-user);
  }
}

// Regular style of triangle-exclamation
.triangle-exclamation {
  @extend %fa-icon;
  @extend .fa-regular;

  &:before {
    content: fa-content($fa-var-triangle-exclamation);
  }
}

// Light style of newspaper
.newspaper {
  @extend %fa-icon;
  @extend .fa-light;

  &:before {
    content: fa-content($fa-var-newspaper);
  }
}

// Thin style of paintbrush-fine
.paintbrush-fine {
  @extend %fa-icon;
  @extend .fa-thin;

  &:before {
    content: fa-content($fa-var-paintbrush-fine);
  }
}

// Duotone style of camera-retro
.camera-retro {
  @extend %fa-icon;
  @extend .fa-duotone;

  &:before {
    content: fa-content($fa-var-camera-retro);
  }
}

// Twitter brand icon
.twitter {
  @extend %fa-icon;
  @extend .fa-brands;

  &:before {
    content: fa-content($fa-var-twitter);
  }
}

// Sharp Solid style of trash
.trash {
  @extend %fa-icon;
  @extend .fa-solid;
  @extend .fa-sharp; // define Sharp family

  &:before {
    content: fa-content($fa-var-trash);
  }
}

// Classic Solid style of trash
.trash {
  @extend %fa-icon;
  @extend .fa-solid;
  @extend .fa-classic; // explicity setting Classic family (optional since this is Font Awesome's default)

  &:before {
    content: fa-content($fa-var-trash);
  }
}

Included Mixins

Utilities What It Does
fa-sr-only() A mixin that visually hides an element containing a text-equivalent for an icon while keeping it accessible to assistive technologies
fa-sr-only-focusable() A mixin that is used alongside fa-sr-only() to show the element again when it’s focused (e.g. by a keyboard-only user)
fa-icon() A mixin that contains all of the base style set up for an icon (minus an icon's style and specific name/unicode) compile
fa-icon-solid()
fa-icon-regular()
fa-icon-light()
fa-icon-thin()
fa-icon-duotone()
fa-icon-brands()
Mixins that contain all of the base style set up for an icon along with a specific style to render the icon in
fa-family-sharp()
fa-family-classic()
Mixins that, when combined with fa-icon- style mixins, define the family of styles to be used.
fa-content() A mixin to make referencing icons via the CSS content property a bit easier.
An icon's variable must be passed in (e.g. fa-content($fa-var-user);).

Simplify and Customize with Variables

Font Awesome's SCSS version also leverages several SCSS variables (opens new window) that allow for easier set-up and customization of our styling toolkit.

Variable What It Does
$fa-css-prefix Sets the prefix (default set to fa) used on all styling toolkit CSS rules (e.g. fa-lg) + icon reference classes (e.g. fa-user)
$fa-style Sets the default icon style (using @font-face weight)
$fa-style-family Sets the default font-family used
$fa-display Sets the display (opens new window) property (default set to inline-block) for rendered icons
$fa-font-display Sets the font-display (opens new window) property for Font Awesome's icon fonts
$fa-fw-width Sets the width (opens new window) property for all fixed-width icons
$fa-inverse Sets the color (opens new window) property of .fa-inverse
$fa-border-color Sets the border-color (opens new window) property used in bordered icons
$fa-border-padding Sets the padding (opens new window) property used in bordered icons
$fa-border-radius Sets the border-radius (opens new window) property used in bordered icons
$fa-border-style Sets the border-style (opens new window) property used in bordered icons
$fa-border-width Sets the border-width (opens new window) property used in bordered icons
$fa-li-width Sets the width (opens new window) property for fa-li elements when styling icons in a list icons
$fa-li-margin Sets the margin-right (opens new window) property for fa-li elements when styling icons in a list icons
$fa-pull-margin Sets the margin-left/margin-right (opens new window) property for pulled icons icons
$fa-primary-opacity Sets the opacity (opens new window) of a duotone icon's primary layer
$fa-secondary-opacity Sets the opacity (opens new window) of a duotone icon's secondary layer
$fa-size-scale-base Sets the base step size that all other relative sizing steps are based on
$fa-size-scale-2xs Sets the size of step used when relatively sizing icons with .fa-2xs
$fa-size-scale-xs Sets the size of step used when relatively sizing icons with .fa-xs
$fa-size-scale-sm Sets the size of step used when relatively sizing icons with .fa-sm
$fa-size-scale-lg Sets the size of step used when relatively sizing icons with .fa-lg
$fa-size-scale-xl Sets the size of step used when relatively sizing icons with .fa-xl
$fa-size-scale-2xl Sets the size of step used when relatively sizing icons with .fa-2xl
$fa-stack-vertical-align Sets the vertical-align (opens new window) property of stacked icons
$fa-stack-width Sets the width (opens new window) property of stacked icons
$fa-stack-z-index Sets the z-index (opens new window) property of stacked icons
$fa-font-path Sets the location of Font Awesome's webfonts folder and assets.