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

Removing the Paragraph Return at the End of Story

I don’t like to have extra stuff floating around my InDesign documents. For example, I don’t like to have blank, empty frames sitting around — I always take the time to delete them. Similarly, I like to remove the blank carriage return at the end of text frames so that the story ends without an extra return. There’s no pressing reason why you need to do this. In fact, if there’s a chance that the frame will someday be threaded together with another frame, you probably do want the extra return there (or else you’ll get the last paragraph of one frame merged with the first paragraph of another frame).

However, let’s say you want to remove those extra returns. (That’s one of the email requests I received this morning.) How to do it? In CS2, you’re probably stuck with manually clicking and deleting. Perhaps someone has a script that will do it.

But in CS3, you can use GREP. Open the Find/Change dialog box (Command/Ctrl-F), switch to the GREP tab (press Command/Ctrl-2), make sure the Search pop-up menu is set to Document, and type this in the Find What field: \s+\Z

Leave the Change To field blank and then click Change All. InDesign should remove the blank return at the end of every story in your document.

This appears to work because of a hidden, undocumented code: backslash-Z appears to mean “at the end of story.” So this GREP code says “find one or more spaces at the end of the story.” Note that \A seems to mean “at the beginning of the story,” so if you want to remove extra white space at the beginning of the story, you’d type \A\s+

Thanks to Gerald Singelmann who pointed out on the Adobe forums that someone told this trick to him, but he can’t remember who. Sounds very mysterious to me!

Warning: I don’t guarantee that these kinds of undocumented tricks will work; save your document before running large GREP searches, proof your work afterward to make sure it didn’t mess anything up.

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

28 Comments on “Removing the Paragraph Return at the End of Story

  1. Thanks David, Your are a life saver, I’ve tested it and works with out breaking any sweat. I’ve been looking for a solution for this problem for quite some time. Thanks to your post it will save some time & pain from now on. Hopefully this post will help others who have been going through the struggle as i did. Load of thanks

  2. you can also just do a search and replace on ^p^p and replace with ^p and that’ll pull out all extra paragraph spaces. you shouldn’t have them within your text anyway if properly formated.

  3. I have worked with old comps who told me all about the teletypewriter, baudot code, linotype, et al printing machines along with RRTY, ITA2 (used by Western Union I believe).

    One printing machine was just a big strip of punched card with a pattern of holes throughout.

    In those days there weren’t any such thing as a space before and after. The carriage return was the only way to seperate paragraphs of text.

    Sadly those days are not long gone. Computers and Typesetting/Designing applications are relatively new in terms of printing, albeit a revolutionary introduction.

    Because the olden days of printing are not really that old there are old comps who have moved onto typesetting on a computer. All they have is a keyboard and a page and they don’t know about all the other things they can do regards paragraph and character attributes they can apply.

    All they need to know is, Type Size, Font and Leading and they are ready to do their job.

    So not everyone knows how to set properly regards today’s methods. And so there are some people who still like to put in a carriage return instead of space before and after.

    With this in mind, the above method is a perfect way to remove extra spaces and not only that any other thing you might have at the end of documents that you don’t want.

  4. David, couldn’t you just hit Ctrl or Command-Z? If a GREP Find/Change doesn’t quite do what it is supposed to do? All the changes should be undone in one hit afaik (maybe I’m wrong?).

  5. Cari, hey! What are you doing here? Aren’t you supposed to be prepping for The InDesign Conference in Melbourne tomorrow? ;)

    Yes, you are absolutely correct: If something goes wrong with the find/change, you should be able to Undo it. But to be honest, I trust Revert more than Undo for something like this. Just superstitious.

  6. I’m sitting here with Olav Martin Kvern, and he says (about this GREP trick), “Oh, I’ve known about that for a while.” Then he throws out a bonus trick: You can use the same trick to add a bullet at the end of all your stories:

    Search for (.\Z) and replace with $1? (or whatever bullet character you want).

    Note that at first glance there doesn’t appear to be any difference between uppercase and lowercase Z. Let me know if anyone finds a difference.

  7. Thank you, David! Throughout the years I have manually deleted hordes of those pesky end-of-story CRs, but now I finally have the magic bullet solution — duly saved as a GREP preset.

  8. Just watch out if the last character in your story is an inline or anchored frame. That GREP of Ole’s will do a real nasty — the frame disappears but the story editor shows the anchor as still there.


  9. How would one go about adding something to the end of a story? I need to add ” (NIV)” to the end of every story with the “!Reference” paragraph style.

    I set the GREP to…
    Find What: \Z
    Change To: (NIV)
    Search: Document
    Find Format: Paragraph Style: !Reference

    When I click the Find Button my text cursor goes to the end of a story. When I click the Change button, nothing happens.

  10. @Syl: I believe you need to find an actual character. For example, search for .\Z (dot backslash Z) and then replace with $0(NIV)
    The $0 is grep for “whatever you found” (in this case, the last character of the story.

  11. @David: Thank you. Your suggestion worked. Knowing about $0 helped me. I was able to search for the any digit wildcard followed by \Z and replace with $0 (NIV). Thank you for your help.

  12. Thank you, thank you, thank you!!!

    This is very important if you have text in a table. The extra paragraph makes the whole box longer. And you can’t replace ^p^p with ^p in some instances because the hash symbol is at the end, causing its own paragraph without being a paragraph symbol.

  13. This works great in the InDesign CS3 Find and Replace dialog box…but I am trying to use it in a javascript and it gets ignored. Anyone have any insight?

  14. I’ve just discovered that this search can really break things if the last thing in a frame is a table without a carriage return after it. The search finds the carriage return before the table and removes it, which can mess up the spacing between the last line of text and the table.

  15. Hi,
    So I now know that \Z finds the end of story using grep. Any chance one of you would know how to find the beginning of a story?

    Thanks for your great site.


  16. Thanks Jongware, so it is. I found this (?-m)^\w but \A is so much more elegant.

    Love your work and thanks again.

  17. find=”\r\z” repalce with=””
    If you enter backslashes in the findWhat property of the findGrepPreferences object, they must be “escaped”

  18. Thankyou! I had 350 pages with about ten end of paragraphs on each one – you’ve saved me hours.
    But I did use /r to do the whole document.

  19. Is there a way to run both beginning and ending paragraph break removals in the same “find what” line under the grep tab?

    I’ve been trying to find a way to run both at once but have not been successful.

    Thank you for sharing this tip! I am sharing it with my entire design department – almost every text box we work with has this issue. Huge time saver.

Leave a Reply

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