How to Automatically Resize 24-Point Text to 16-Point in Google Docs Using Apps Script

Formatting large documents in Google Docs can quickly become tedious—especially when inconsistent font sizes are scattered throughout your content. A common issue many users face is having body text accidentally formatted at a larger size, such as 24 pt, when it should be standard reading size like 16 pt.

Instead of manually searching and fixing each section, you can automate this task using Google Apps Script.

In this guide, you’ll learn how to create a simple script that:

  • Scans your entire document
  • Finds only normal body text (not headings)
  • Detects text formatted at 24 pt
  • Automatically resizes it to 16 pt

Why Use Apps Script for Formatting Tasks?

Apps Script is incredibly powerful for document automation. It allows you to:

  • Save hours of repetitive editing
  • Maintain consistent formatting across long documents
  • Clean up imported or AI-generated content
  • Apply precise rules that built-in formatting tools cannot handle

This is especially useful when working with:

  • Reports
  • Course materials
  • AI-generated drafts
  • Imported content from PDFs or Word

The Solution: Automated Font Size Correction

The script below works by examining each paragraph and checking the font size of individual text ranges. If it finds text at exactly 24 pt, it changes only those characters to 16 pt, leaving everything else untouched.

It also ensures that only normal body text is affected, meaning headings and structured elements remain unchanged.


The Apps Script Code

function resize24To16() {
  const doc = DocumentApp.getActiveDocument();
  const body = doc.getBody();

  const paragraphs = body.getParagraphs();

  paragraphs.forEach(paragraph => {
    if (paragraph.getHeading() === DocumentApp.ParagraphHeading.NORMAL) {
      const text = paragraph.editAsText();
      const length = text.getText().length;

      let start = -1;

      for (let i = 0; i < length; i++) {
        const size = text.getFontSize(i);

        if (size === 24) {
          if (start === -1) start = i;
        } else {
          if (start !== -1) {
            text.setFontSize(start, i - 1, 16);
            start = -1;
          }
        }
      }

      if (start !== -1) {
        text.setFontSize(start, length - 1, 16);
      }
    }
  });

  Logger.log("Resize complete!");
}

How to Install and Run the Script

Follow these simple steps:

Step 1 — Open Script Editor

  • Open your Google Doc
  • Click Extensions → Apps Script

Step 2 — Add the Code

  • Delete any placeholder code
  • Paste the script above

Step 3 — Run the Script

  • Click Run
  • Grant authorization when prompted

Once completed, the script will automatically resize all qualifying text.


What the Script Handles

This solution is designed to be safe and precise.

It will:

  • Detect mixed formatting within paragraphs
  • Preserve bold, italics, and colors
  • Skip headings automatically
  • Change only exact matches to 24 pt

It will NOT:

  • Alter other font sizes
  • Modify heading styles
  • Change structural formatting

When This Automation Is Most Useful

You’ll find this particularly valuable if you:

  • Import content from other sources
  • Use AI tools that output inconsistent formatting
  • Manage collaborative documents
  • Create educational or training materials
  • Maintain standardized document templates

Possible Enhancements

You can extend this script to perform more advanced formatting automation, such as:

  • Fixing multiple font sizes at once
  • Processing text inside tables
  • Adding a custom menu button
  • Running batch formatting across multiple documents
  • Standardizing entire document style systems

Final Thoughts

Small automation scripts like this can dramatically improve your workflow and ensure consistent document formatting without manual effort.

Google Apps Script gives you the ability to turn repetitive editing tasks into one-click solutions — saving time and reducing errors.

If you frequently work with large or collaborative documents, learning simple automation like this can become a powerful productivity advantage.