How to use custom fonts in Laravel's blade?

Stefan Bogdanescu

Founder & Senior Architect · 2026-06-29

Laravel Company
# How to Use Custom Fonts in Laravel Blade: A Complete Guide As a senior developer working with the Laravel ecosystem, you often encounter the need to move beyond default system fonts and implement custom typography. You’ve successfully organized your custom font files—like `Muli`, `Muli-Bold`, and `Muli-ExtraBold`—into your public directory. The next logical step is figuring out how to instruct the browser to recognize and apply these beautifully crafted fonts within your Blade templates. This guide will walk you through the complete process, moving from file organization to final rendering in your Laravel application. ## The Foundation: Understanding `@font-face` The key to using any custom font on the web is defining it using the CSS `@font-face` rule. This rule tells the browser where to find the font files and what name to use when referencing that font throughout your stylesheet. Laravel itself handles routing and logic, but the actual visual presentation of typography is entirely managed by CSS. Since you have placed your font files in the `public/fonts` directory, you must first create a CSS file (e.g., `app.css`) where you define these fonts. Here is how you would set up the definitions: ```css /* styles.css */ @font-face { font-family: 'Muli'; src: url('fonts/Muli.woff2') format('woff2'), url('fonts/Muli.woff') format('woff'); font-weight: 400; font-style: normal; } @font-face { font-family: 'Muli-Bold'; src: url('fonts/Muli-Bold.woff2') format('woff2'), url('fonts/Muli-Bold.woff') format('woff'); font-weight: 700; font-style: normal; } /* You would define other weights similarly... */ ``` **Developer Insight:** Notice how the `src` paths must be relative to where your CSS file is loaded. If you are using Laravel Mix or Vite for asset compilation (which is highly recommended in modern Laravel projects), these assets are bundled and served efficiently, making font loading a seamless part of your application's delivery pipeline. ## Linking Stylesheets in Your Blade View Once the fonts are defined in your CSS, you need to ensure that those styles are actually loaded by the HTML page where you are displaying content. In Laravel, this is done by linking your compiled assets within your main layout file. In your primary Blade layout (e.g., `layouts/app.blade.php`), make sure you link your stylesheet: ```html My Laravel App {{-- Link to your compiled CSS file --}} ``` ## Applying Custom Fonts in Blade Now that the fonts are loaded via CSS, you can use the defined `font-family` names directly within your Blade HTML to apply the custom typography wherever needed. For example, to set the main body text to your custom 'Muli' font and headings to the bold variant: ```html {{-- In a specific Blade file like resources/views/posts/show.blade.php --}}
{{-- Use the regular weight for paragraph text --}}

This is the main content of the article, using the standard Muli font.

{{-- Use the bold weight for emphasis or headings --}}

Chapter One: Introduction

We are demonstrating how custom fonts integrate smoothly into a Laravel application structure. This is where efficient asset management, as emphasized by frameworks like Laravel, truly shines.

``` ## Conclusion Using custom fonts in Laravel Blade is fundamentally a front-end exercise managed through the power of CSS, but it is integrated seamlessly into the Laravel workflow. By correctly defining the `@font-face` rules and ensuring your assets are properly compiled by your build tools (like Vite or Mix), you can leverage the full potential of custom typography. Remember, the Blade file acts as the structural layer, while the CSS handles the visual presentation—a perfect example of separating concerns that makes large applications maintainable.