Clean Up Spurious White Space
The script removes leading, trailing, and duplicate white space. Optionally change all caps to sentence case.
Oops, you’re not logged in!
Log in or sign up for a free account.
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 September 30, 2026
This article was first published on January 25, 2026
Commenting is easier and faster when you're logged in!
Recommended for you
Setting Table Subhead Rows to a Cell Style with a Free Script
I use computers because I’m basically lazy and I want them to do the work for me...
Index Fixes
The usefulness of InDesign’s index function is constrained by bugs and absent fe...
Text Anchors
It's not possible in InDesign to get an overview of what a document's text ancho...
