Link to Text Fragment Generator

Paste a URL and some text from the page into the fields below to generate a link1 that will take you directly to that text when you click it.

Tips and Tricks

  • There are browser extensions that will do this for you from right clicking a text selection on a page! That said, the reason I wrote this was because the ones I tried didn’t work for me.

  • Each of Prefix, Start (Text), End, and Suffix will only match text within a single block-level element, but StartEnd ranges can span multiple blocks.

  • You can specify multiple text fragments in a single URL by joining text=… parameters with &, like this: #:~:text=generate%20a%20link,-1&text=that-,text.

  1. URL Fragment Text Directives. Draft Community Group Report, 13 December 2023