Quickly Find All Font Sizes Used on a Web Page: How-To Guide

Robert Gourley Unsplash

As designers, we often need to audit an existing product to improve the overall UX, or to start a design system. I was looking for an easy way to get all of the font styles from a webpage and couldn't find a great existing solution. I wrote this JavaScript snippet that retrieves all font sizes, weights, and more in use on a webpage. This guide will walk you through using this tool directly in your browser’s Developer Tools (DevTools). Hopefully it will help if you are looking to gather all font styles from a page.


Ensure you are familiar with your browser’s Developer Tools. For this guide, we will assume you are using Google Chrome, but the process should be similar in other browsers.

Using the Script in DevTools

  1. Open DevTools: Right-click on your webpage and select ‘Inspect’ or press Ctrl+Shift+I (Windows/Linux) or Cmd+Opt+I (Mac) to open DevTools.
  2. Navigate to Console: Click on the ‘Console’ tab. This is where we will be working.
  3. Copy and Paste the Script: Below is the JavaScript snippet. Copy it.
  1. Run the Script: Paste the script into the console and press Enter. The script will execute, and the results will be printed directly in the console.

Understanding the Output

The script outputs CSS-like rules for each font family found on the page, including all unique combinations of font size, font weight, and line height applied. Each rule is a class that you can use to reference the specific style combination.

.font-family-arial {
  font-family: 'Arial';
  font-size: 14px; font-weight: 400; line-height: 20px;
  font-size: 16px; font-weight: 700; line-height: 24px;

.font-family-times-new-roman {
  font-family: 'Times New Roman';
  font-size: 18px; font-weight: 400; line-height: 28px;
  font-size: 20px; font-weight: 400; line-height: 32px;

Using the Data

With this data, you can:

  1. Audit Your Styles: Ensure that your webpage is using a consistent and optimized set of font styles.
  2. Clean Up: Identify and remove unused or redundant styles to improve performance.
  3. Standardize: Use the data to create a standardized style guide for your webpage or application.

This JavaScript snippet provides a powerful tool for web developers and designers to understand and optimize the typographic elements of their websites. By using your browser's DevTools and the provided script, you can quickly and easily extract a comprehensive list of all font styles in use on a page, aiding in consistency, performance optimization, and design standardization.