Clean Up Spurious White Space
The script removes leading, trailing, and duplicate white space. Optionally change all caps to sentence case.
This script is part of the Type and Text collection. See the full collection here.ย
The script removes spurious white space (multiple returns, tabs, spaces). With nothing selected, the script processes the whole active document; with some text frame(s) or text selected, only that selection is dealt with.You can optionally replace all caps with sentence case: just tick the checkbox in the script’s interface.

Press OK or Enter/Return to run the script.
Peter Kahrel Script Repository
Hosted as a community service, and with deep appreciation, by CreativePro.com
Scripts by Topic | Script Index
Basic Script Installation and Use
How to Modify or Configure These Scripts
Resources for Scripting and Publishing Automation
About This Repository
Contact Peter Kahrel
Note to users: You run scripts at your own risk: CreativePro and the author accept no liability for anything that may be caused by any of these scripts. Always take the necessary precautions. We encourage you to save backups and test scripts on copies of your documents.
This article was last modified on August 22, 2026
This article was first published on January 25, 2026
Commenting is easier and faster when you're logged in!
Recommended for you
GREP Query Manager
The script displays an overview of all your GREP queries and their contents. Que...
Getting Started with XML in InDesign Part 2
Learn how to complete an XML workflow circle and follow along with the downloada...
GREP Mapper: Display the Scope of GREP Wildcards
InDesign offers 37 Unicode GREP wildcards (\p{P*}, \p{Lt}, etc.), which brings t...
