Thanks for coming to, the world's #1 resource for all things InDesign!

How to Type “The Last Page Number in a Book”

You already know that InDesign has a “the last page number” text variable, right? To get that, you choose Type > Text Variables > Insert Variable > Last Page Number. And because it’s a variable, it automatically updates if the last page number of that document changes. Cool!

But what if you want “the last page number in a book” — that is, not the last page number in this document, but in the last file in a book panel? InDesign doesn’t have a variable for that.

(By the way, one reason why it doesn’t is that the same document can be in more than one book. I usually don’t recommend doing that, but if you did do that, the text variable would get mighty confused as to which book you were talking about.)

Okay, so there’s no variable, but sometimes we really need to grab that number. For example, if your headers are supposed to read “Page 1 of 28” or something like that. Here’s the secret: Use cross-references.

In order for a cross-reference to work, you need to point it to some text or a text anchor. I usually just throw a piece of text in a frame on the last page, like this:


And you need to apply a paragraph style to that text. It doesn’t really matter what you use, but I make a style just for that one paragraph. Also, make sure that the text is in a frame that is set to Nonprinting in the Attributes panel (so it won’t print). I did that in the frame above, but you can’t see it in the panel because I have the text cursor inside the frame. (If I had clicked on the frame with the Selection tool, you’d see Nonprinting selected in the Attributes panel.)

Now, back in your other document, you can use that page number by creating a cross-reference in the Cross-References panel. First you place your cursor where you want the page number to be displayed (I’ve put it inside a text frame in the header on my master page):


…and then when you click the New Cross Reference button, you can choose your “last page” paragraph:


To select that paragraph, I chose the last document of the book in the Document pop-up menu of the Destination section, and then I chose the paragraph style, and then I clicked on the paragraph I wanted to point to. Finally, note that I’m choosing Page Number from the Format pop-up menu. That means I will only get the page number in my cross-reference.

When I click OK, InDesign inserts the page number into the text frame:


Of course, then if I later change the number of pages in any of my documents, the cross-reference will update automatically. See, here I have added 2 pages to chapter 1:


Important note: When you add the page numbers, the cross-reference page number doesn’t update on your page immediately! You sometimes need to give it a few seconds and you need to change the screen view. That is, it won’t update on screen until you change from one page to the next, or zoom in and out, or do something else that forces the screen to redraw.

Editing the Cross-Reference

[I’m adding this section a few days after writing the text above because I just realized I didn’t finish the process above.]

If you look closely, you’ll see that the “Page Number” cross-reference we used above shows up as “page 14” — that is, it actually shows the word “page” and we don’t want that. Fortunately, it’s easy to get rid of by editing the x-ref you made.

First, double-click the x-ref inside the Cross References panel, to open the Edit Cross-Reference dialog box. Then click the little pencil icon next to the Format pop-up menu. This lets you change how the cross-reference shows up on your page.

In the Cross-Reference Formats dialog box, choose Page Number in the list on the left, and then click the + (plus) button at the bottom, which duplicates it. Now change the name, and remove the word “page” in the Definition. It should look like this:


After you click OK, make sure your new format is selected inside the Format pop-up menu of the cross-references dialog box… then click OK. Now your page number should appear without the word “page” in it, like this:


Whew! The good news is that you only have to do this once. From then on, you can copy and paste this text frame to the master pages of your other book documents. And once you make that cross-reference format, InDesign remembers it for other documents, too.

David Blatner

David Blatner

David Blatner is the co-founder of the Creative Publishing Network, InDesign Magazine, and the author or co-author of 15 books, including Real World InDesign. His InDesign videos at are among the most watched InDesign training in the world. You can find more about David at
David Blatner

Latest posts by David Blatner (see all)

  • - November 30, -0001
Related Articles

9 Comments on “How to Type “The Last Page Number in a Book”

  1. Argh – cross-references across documents in books is a pain – as I understand it, InDesign opens each document in the background to update the numbers, and this can cause considerable slow down – depending on how many pages have the cross-references, how many documents etc. I may be wrong, but that’s how I understand it.

    • Yes, it can definitely slow you down if you have many of them. But in this case, it’s one or two per chapter, and they’re all pointing to the same file (the one at the end). Note that part of the “open each document in the background” isn’t just the cross-reference, it’s the renumbering of the documents. If you add pages in chapter 1, then ID has to open, adjust the page numbering, save and close every subsequent document… and then also adjust the x-refs. You can disable that temporarily by choosing Book Page Numbering Options in the book panel menu, and then turning off the Automatically Update Page & Section Numbers checkbox.

  2. Ooops! I just realized I left out an important step when I originally wrote this up. Must have been typing too fast. Okay, I just now added the final section called “Editing the Cross-Reference.”

  3. Wow, a few weeks ago I was looking desperately for such a solution, but anybody told me “ID can’t do that.”. Thanks for this!

  4. This nice solution but wouldn’t work in my case. I have a document with 9 pages with different three sections, each section have 3 pages and have its own numbering style. when I follow your solution by putting my cross reference in the last page of section 3 I get the number (3), which is the last page number of section 3. I am expecting to get the last page number of the whole document which is (9) in my case. so please advise, how to get the last pages of the whole document ignoring the section numbering?

  5. I don’t know whether it’s just me or if everyone else experiencing problems with your
    blog. It appears as if some of the text in your posts are running off the screen. Can somebody
    else please provide feedback and let me know if this is happening to them too?
    This might be a problem with my browser because I’ve had this happen previously.
    Thank you

Leave a Reply

Your email address will not be published. Required fields are marked *