Text Anchors
It's not possible in InDesign to get an overview of what a document's text anchors (a.k.a. Hyperlink Text Destinations) are used for. The script does give you such an overview...
This script is part of the Notes collection. See the full collection here. For more information about using the scripts in this collection, see ย Adding and Deleting Notes: Managing Cross-References.
This script is part of the Type and Text collection. See the full collection here.ย
Text anchors are useful things. InDesign uses them as targets for cross-references, hyperlinks, and bookmarks (when you create a bookmark, a text anchor is created behind the scenes), and you can add text anchors for your own use. When you delete a bookmark, its associated text anchor is deleted along with it. But when you delete hyperlinks and cross-references, their destination text anchors remain in the document.
This can lead to many orphaned text anchors. Though they do no harm other than cluttering some of the hyperlink dialogs, I like to get rid of orphaned anchors every now and then. Unfortunately, it’s not possible in InDesign to get an overview of what a document’s anchors are used for.
Another shortcoming in the way that InDesign manages its anchors is that it’s not possible to show where anchors are. It’s sometimes useful to see an overview of the text anchors in a document, on a page, or in some selected text.
The only thing that InDesign has to offer to manage text anchors (using the term ‘manage’ very loosely here) is the Hyperlink Destination Options window:

You can rename a text anchor and you can move an anchor to the current text insertion point โ or so you’re led to believe, but it doesn’t work: the anchor is moved to the beginning of the story.
The script described here addresses all this and adds functionality. It lists all text anchors in a document and shows if they are in use and if yes, what they are targeted by:

The first column shows the name of all text anchors in the document; in the second column you see what the anchor is targeted by (‘Xref’ for ‘cross-reference’), and the third column displays the name of the source. If columns 2 and 3 are empty, the text anchor is not targeted by anything in the document, though it could be targeted by a hyperlink in another document.
If a text anchor is used by more than one hyperlink or cross-reference, only one instance is listed (after all, there’s just one text anchor) and the types and names are shown separated by a slash.
If you have several documents open and a text anchor is targeted by a hyperlink or cross-reference in another document, the source type and source name are marked with an asterisk.
The text field and the buttons function as follows. Most functions are pretty straightforward.
Text field
The text field can be used to filter the list. When I type drop there and press the tab key (or click outside text field), the list is filtered to contain only the anchors whose name contains drop:

To show only the anchors whose name begins with drop, enter ^drop โ you can use standard JavaScript regular expressions in the field.
Go to selected
The text anchor is selected and the script sets the zoom to 400% so that the selected anchor becomes visible.
Rename
Rename the text anchor.
Move to ip
This fixes the InDesign move function. To move a text anchor, select the insertion point that you want to move the anchor to and click Move to ip.
Delete selected
Delete the selected text anchors. You can delete only unused anchors. And remember that if an anchor is flagged as unused it could be the target of a hyperlink or cross-reference in another (unopened) document.
Select unused
Select all text anchors in the document that aren’t targeted by anything. Remember that anchors flagged as unused could be the target of hyperlinks or cross-references in other (unopened) documents.
Show anchors
To display the location of anchors, click Show anchors. The script adds small anchored frames at the page edge and adds the anchor’s name to the frame. To make visible the line that connects the anchored frame and its anchor โ as in the screenshot โ make sure that text thread display is enabled (View > Extras > Show Text Threads), and select the text frame that contains the anchored frame:

Here, stack difference Mac/PC is the name of the text anchor that’s at the beginning of the word differently.
With nothing selected, all text anchors in the document are displayed; with a selection, only the anchors in the selection are shown. (Note: when you select a text frame, the script shows the anchors much quicker than when you select some text.)
Note that InDesign shows text anchors in the story editor:

But that won’t tell you the name of that anchor, and the story editor can be very sluggish in long documents.
Delete displayed anchors
To remove all displayed anchor frames, click Delete displayed anchors โ this removes just the text frames with anchor names, not the anchors. The styles that were created (a paragraph and an object style) and the swatch are deleted too.
The list is saved on a text file as regular text table with tabs for column separators. The file is saved in the active document’s folder, using the document’s name withย text-anchors.txtย added to it.
Version history
30 Aug. 2024: (a) If a script label was set on a text anchor, it’s shown in the new column Label. If you can’t see it, resize the columns (drag a header’s right edge). This problem is related to the next point. (b) The script’s window is no longer resizable. ScriptUI is clueless on high-resolution screens (4K and higher). (c) Added a Print button so you can export the list to a text file. (see the text for details.
6 Oct. 2022: Added another source type (page item), its absence crashed the script.
26 May 2021: Anchors weren’t displayed if the styles were already present in the document. Fixed.
8 Aug. 2020: The script now shows only the text anchors in the open document(s).
24 July 2020: Caught a fatal InDesign exception when deleting displayed anchors.
20 Nov. 2019: Fixed a bug in the display of anchor types.
29 Dec. 2018: (a) If the document contains a hyperlink that targets an anchor in a document that’s not available, the script crashed. Fixed. (b) Added a note in the text to say that if columns 2 and 3 are empty the anchor is not targeted by anything in the document but could be targeted by a hyperlink in a document that is not available.
4 Mar. 2018: (a) If a text anchor was the source of more than one hyperlink and/or cross-reference, each instance was listed separately. Fixed (see the text for details); (b) if an anchor’s source is in another document, the source name and type are marked with an asterisk; (c) the window can now be resized.
1 Jan. 2017: If an anchor was in a table or in a footnote, the ‘Go to selected’ function didn’t work properly. Fixed.
8 May 2016: Added code to get around the problem that listboxes don’t display in CS6 on Windows 10.
10 Apr. 2016: Largely rewrote the script and added some functions (filtering the display, move anchors).
19 Oct. 2014: Added a button Show anchors to show where a document’s text anchors are. Names are aded in anchored frames. And a button to delete those frames.
3 Dec. 2012: Added a note to say that I discovered that in 2010 Gerald Singelmann wrote a script that has some of the functionality of my script (http://www.indesign-faq.de/de/textanker-pflegen).
26 August 2012: First posted.
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
Free Webinar: Cross App Power Hour with Illustrator, InDesign, and Firefly
Explore practical AI-powered tools in Illustrator, InDesign, and Firefly that wi...
InQuestion: TOC Leader Dots and Pull Quotes
Learn some creative solutions for designing tables of contents and pull quotes i...
Right-to-Left Panel: Expose Middle-East Properties in Any InDesign Version
The script displays a panel that exposes Middle-East (right-to-left direction et...
