Create Table of Contents in Google Docs: Step-by-Step Guide

Johnny Jul 09, 2026

Ever found yourself wishing you could create a table of contents (TOC) in Google Docs to navigate your lengthy documents with ease? You're not alone. Google Docs, while powerful, doesn't natively support TOC creation. However, there's a workaround that allows you to achieve this. Let's dive into the process.

Creating a table of contents in Google Docs - Lepre's Learning Log
Creating a table of contents in Google Docs - Lepre's Learning Log

Before we begin, it's important to note that this method uses bookmarks and a script to generate the TOC. It requires a bit of setup, but it's well worth the effort for long documents. Now, let's get started.

How to make and edit a table of contents in Google Docs to easily navigate to sections of a document
How to make and edit a table of contents in Google Docs to easily navigate to sections of a document

Setting Up Your Google Doc for a Table of Contents

To create a TOC in Google Docs, you first need to set up your document with headers and bookmarks. Headers will serve as your TOC entries, and bookmarks will help the script link them together.

4 Easy Steps to Make a Table of Contents in Google Docs
4 Easy Steps to Make a Table of Contents in Google Docs

Here's how to do it:

Adding Headers

Google Docs can make a table of contents for you — here’s how
Google Docs can make a table of contents for you — here’s how

Use Google Docs' built-in heading styles (Heading 1, Heading 2, etc.) to create your TOC entries. These will appear in your TOC once you've set it up.

To apply a heading style, select the text, then click on the 'Heading' dropdown in the toolbar and choose the desired style.

Creating Bookmarks

How to Create a Table of Contents in Google Docs
How to Create a Table of Contents in Google Docs

Bookmarks will help the script link your TOC entries to their respective sections in the document. Here's how to create them:

1. Select the text you want to bookmark (usually the same text you've formatted as a header).

2. Right-click (or control-click on a Mac) and select 'Add bookmark' from the context menu.

a woman with curly hair smiling and wearing a t - shirt that says how to create a table of contents in google docs
a woman with curly hair smiling and wearing a t - shirt that says how to create a table of contents in google docs

3. Give your bookmark a name. This name should be unique and descriptive, as it will help you identify the bookmark later.

Installing the TOC Script in Google Docs

How to Make a Table of Contents in Google Docs and Update It Afterwards
How to Make a Table of Contents in Google Docs and Update It Afterwards
How to Create a Table of Contents in Google Docs (NEW Features)
How to Create a Table of Contents in Google Docs (NEW Features)
How to Make Table of Contents in Google Docs
How to Make Table of Contents in Google Docs
How to Make a Table of Contents in Google Docs
How to Make a Table of Contents in Google Docs
someone is pointing to the table of contents on their computer screen that says google docs
someone is pointing to the table of contents on their computer screen that says google docs
G Suite: Google Docs now has Page Numbers in Table of Contents
G Suite: Google Docs now has Page Numbers in Table of Contents
Organize Digital Files
Organize Digital Files
How to Create a Table of Contents in Google Sheets
How to Create a Table of Contents in Google Sheets
Create a Digital Table of Contents With Google Sheets
Create a Digital Table of Contents With Google Sheets
How to Create a Clickable Table of Contents in Google Docs
How to Create a Clickable Table of Contents in Google Docs
How To Make A Table Of Contents In Google Docs
How To Make A Table Of Contents In Google Docs
How to Create a Table of Contents in Google Docs | Update a Table of Contents in Google Docs
How to Create a Table of Contents in Google Docs | Update a Table of Contents in Google Docs
Google Docs: Table of Contents, Headers, & Outline Tool
Google Docs: Table of Contents, Headers, & Outline Tool
How to Add a TABLE OF CONTENTS in GOOGLE DOCS | Google Docs Tutorial
How to Add a TABLE OF CONTENTS in GOOGLE DOCS | Google Docs Tutorial
How to make a table of contents in google docs document
How to make a table of contents in google docs document
Google Docs: Table of Contents, Headers, & Outline Tool
Google Docs: Table of Contents, Headers, & Outline Tool
Google Docs Tables: edit, arrange, add a header, unsplittable rows, sort, and more!
Google Docs Tables: edit, arrange, add a header, unsplittable rows, sort, and more!
How to Insert Columns into Google Docs
How to Insert Columns into Google Docs
Using the Table of Contents feature in #Google Docs in 5 easy steps! So cool, so simple, so underutilized! #GAFE
Using the Table of Contents feature in #Google Docs in 5 easy steps! So cool, so simple, so underutilized! #GAFE
Free 44+ Table of Contents Templates, PDF, DOC, Google Docs
Free 44+ Table of Contents Templates, PDF, DOC, Google Docs

Now that your document is set up, it's time to install the TOC script. This script will generate your TOC based on the headers and bookmarks you've created.

Here's how to install it:

Accessing the Script Editor

1. Click on 'Extensions' in the menu, then 'Apps Script.'

2. This will open the Script Editor in a new tab.

Pasting the TOC Script

1. Delete any code in the 'Code.gs' file.

2. Copy and paste the following script into the 'Code.gs' file:

function onEdit(e) {

var body = DocumentApp.getActiveDocument().getBody();

var headers = body.getHeadings();

var toc = body.appendParagraph('Table of Contents', DocumentApp-heading1);

for (var i = 0; i < headers.length; i++) {

var header = headers[i];

var bookmark = DocumentApp.getActiveDocument().getBookmarks().getByName(header.getText());

toc.appendLink(header.getText(), bookmark.getElement());

}

}

Saving and Running the Script

1. Click on the disk icon to save the project. Name it 'TOC Script'.

2. Close the Script Editor tab and go back to your Google Doc.

3. To run the script, press 'Ctrl + Alt + S' (Windows/Linux) or 'Cmd + Opt + S' (Mac).

4. A TOC should now appear at the beginning of your document. If it doesn't, try running the script again.

Updating Your Table of Contents

Whenever you add, remove, or rename headers in your document, the TOC will automatically update to reflect those changes. Just run the script again using the keyboard shortcut.

Managing Bookmarks

If you need to manage your bookmarks (e.g., rename or delete them), you can do so in the 'Bookmarks' panel. To open it, click on 'Insert' in the menu, then 'Bookmark'.

And there you have it! You've successfully created a table of contents in Google Docs. This feature can greatly improve the navigability of your long documents, making it easier for you and your collaborators to jump to specific sections.

Now that you've mastered the art of creating TOCs in Google Docs, why not explore other productivity-boosting features? The world of Google Docs is vast and full of hidden gems waiting to be discovered.