Get Hyphens
The script collects the hyphenated words in a document and lists them in a new document or in a list on screen. The breakpoints determined by InDesign are indicated.
This script is part of the Word Division/Hyphenation collection. See the full collection here.ย
This script is part of the Type and Text collection. See the full collection here.ย
This script is part of the Book and Long Document Composition/Production collection. See the full collection here.ย
This script to collect hyphenated words was originally written by the late Teus de Jong as a Delphi program that ran as a separate application in InDesign. Years later, in 2009, when he was finally convinced that JavaScripts had become quick enough, Teus and I ported his Delphi program to JavaScript. After we finished the JavaScript version we discovered that Martin Fischer (independently) had written a comparable script.
The script on this page is a modified version of the one Teus and I had written. There were some inconsistencies in the code, I wanted to add some features, and the interface could be improved. The core of the program, however, remains largely unchanged.
The script collects all words in a document hyphenated by InDesign and, optionally, all hyphenated words, that is, words that always contain a hyphen such as top-bottom and East-West. It then displays them in a window so that they can be processed interactively or outputs them to a new document. In each word, the break is shown by a selectable character such as a swung dash or a dash.
Optionally, words that can be found in the user dictionary can be filtered โ after all, the hypenation of these words is correct by default. Clearly, the advantage of filtering out as many words as possible is that the list produced by the script is shorter and therefore easier to process.
Use
Open a document and start the script. It shows the dialog shown in the screenshot.
Atย Inputย select what should be targeted: the document, the selection’s parent story, or the selected text. The dropdown reflects the selection’s state. To target a story, select a text frame or an insertion point.
Atย Outputย you select how the list with hyphenated words should be displayed: on screen or in a new document. You can choose a separator character atย Separatorย (the options are swung dash, en dash, em dash, hyphen, and underline).

To include compound hyphenated words such as left-right and well-defined, tick the Include hyphenated words checkbox. To distinguish these from automatically hyphenated words in the displayed list, the hyphen is followed by the separator, as in left-~right.
To include only hyphenated words, tick Hyphenated words only.
The last three options refer to document output only. Set the number of columns for the output. Include details prints line numbers and environment (table, footnote, inline); an example is given below. When you output to a document you’re usually not interested in duplicates, so you can choose to remove those.
After the script has collected all hyphenated words, the screen list is shown as in the screenshot below. The list is interactive: double-click a word and its document occurrence is selected and shown. You can correct any mistakes, but the list is not refreshed automatically.

If the list is very long and you can’t process it in one session, Save it on a text file. In a next session you can run the script and tell it to use the text file rather than create a new list: check Use list from text file. Loading that list is quicker than creating a new list, and the last selected item in the list is reselected after the list has been loaded. Press Close to close the window and end the script.
When you opted not to show any details, document output looks the same as the screen output: a list of words with the breakpoint indicated by the separator character.
When you did choose to include details, the script prints the word’s page and line numbers, and if the word is not in the main text, the word’s environment (table, footnote, or inline). Here is an example:

Words that occur outside the main story are grouped together at the end of the list (to be fixed).
Batch-processing corrections
I use the script in conjunction with another one to apply corrected hyphenations; see hyphens_apply.jsx for details.
Version history
23 May 2025: You can now collect hyphenated words in selected text (apart from a story or the whole document).
21 May 2025: Added the option to collect only hyphenated words, i.e. words like left-right.
6 Apr. 2023: Fixed a problem with the paginator (if the selected output was a document).
29 Nov. 2019: Fixed a bug that crashed the script if a story frame was on the pasteboard.
26 Feb. 2017: Sometimes the first page of a document wasn’t reported correctly in the output document. Fixed.
8 Nov. 2016: The dialog’s list display needed the Windows 10 fix. And fixed a problem with how the script recognised the InDesign version it’s running in.
19 June 2016: Added the option to include compound hyphenated words such as left-right and north-south.
4 December 2012: Returned to the script that Teus de Jong and I wrote in 2009. The text on this page was entirely rewritten.
30 November 2012: Added options for filtering and sorting the list.
12 April 2011: Added the possibility to process just the active document or all open documents.
23 July 2010: The script now recognises user dictionaries in other languages than English.
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 November 3, 2025
Commenting is easier and faster when you're logged in!
Recommended for you
Dynamic Endnotes
Convert endnotes (both static and dynamic) to InDesign's (dynamic) footnotes.
Paragraph Numbering Fix
Paragraph numbering works fine within stories, but across stories, numbering is...
Go to the Parent Spread Applied to the Active Spread
To access the parent spread applied to the active page, you have to open the Pag...
