Guides · How to
How to link to specific text on a web page
Send someone a link that scrolls straight to a sentence and highlights it. How text fragment links work, how to make one in each browser, why they sometimes fail, and what to use when you need to point at more than text.
You want to show someone one sentence on a long page. So you send the link and write "scroll down to the third section, the paragraph that starts with pricing". They scroll, miss it, and ask again.
Browsers have a better way built in. It's called a text fragment. It adds a bit to the end of a URL that tells the browser which words to scroll to and highlight, and it works on almost any page without anyone installing anything.
The quick way, by browser
Chrome. Select the text on the page, right-click it, and choose Copy link to highlight. Paste the link anywhere.
Other browsers and phones. Edge, Safari and Firefox all open these links in their recent versions, but where the option to create one lives depends on the browser and version, and on phones it's often buried. The reliable route everywhere is our free link to text generator. Paste the page address and the words, and copy the link.
What the link looks like
The magic is the part after the hash. A link to the words "free forever" on a pricing page looks like this.
https://lasso.team/pricing/#:~:text=free%20forever
There's a small set of rules worth knowing if you ever edit one by hand.
| Part | What it does | Example |
|---|---|---|
#:~:text= |
Starts the text fragment | always the same |
start |
The words to find and highlight | free%20forever |
start,end |
Highlights everything from the first words to the last words | Every%20new,no%20card |
prefix-, |
Words just before the match, to pick the right one when it appears twice | Studio-,plan |
,-suffix |
Words just after the match, for the same reason | plan,-costs |
Spaces become %20, and a dash, comma or ampersand inside the words has to be written as %2D, %2C or %26, because those characters mean something in the fragment itself. The generator handles all of this for you.
Picking text that won't break
Text links match exact words on the page, so the phrase you choose decides how reliable the link is.
- Choose something distinctive. "Billed yearly" works. "The" highlights the first "the" on the page.
- Keep it short. A sentence or two is plenty. Long selections break when any single word changes.
- For long passages, use start and end. Instead of the whole paragraph, give the first few words and the last few. The generator does this automatically for long selections.
- Prefer stable text. Headings and product names change less than marketing copy.
When text links fail
If the page opens but nothing is highlighted, it's almost always one of these.
- The words changed. The page was edited, and the exact phrase no longer exists. Pick a new phrase.
- The text appears more than once. The browser highlights the first match. Add a prefix or suffix, or choose a more unusual phrase.
- The text is hidden. It sits inside a closed tab, an accordion or a part of the page that loads after a click or a scroll, so the browser can't find it when the page opens.
- The browser doesn't support it. Older browsers open the page at the top. Nothing breaks, the highlight just doesn't happen.
- The site rewrote the link. A few sites redirect or strip anything after the hash. There's no fix on your side for that one.
When you need to point at more than text
Text links are brilliant for quotes, but they can't point at a button, a chart, an image or a spacing problem, and they can't carry a note explaining why you're pointing there.
| You want to point at | Use |
|---|---|
| A sentence or quote | A text link |
| A button, image, chart or form field | A pinned comment |
| A layout or spacing problem | A pinned comment on a dragged area |
| Something with a question or request attached | A pinned comment |
| A specific spot you'll want to find again later | A pinned comment, which keeps a screenshot |
Lasso pins a comment to any element on the page and gives it a super link. The link opens the live page at that exact spot with your note on it, and a screenshot is saved in case the page changes. It's the text link idea, for everything else on the page.
So use a text link when you're quoting someone, and a pinned comment when you're starting a conversation about the page.
Questions people ask
Which browsers support links to specific text?
Chrome, Edge and other Chromium browsers support text fragment links, and Safari and Firefox have added support in recent versions. In a browser without support, the link still opens the page, just without the scroll and highlight.
Why does my link to highlighted text not work?
Usually because the text changed or appears in a different form on the page, or because it sits in a part of the page that only loads after a click. Pick a shorter, distinctive phrase and try again.
Can I link to an image or button instead of text?
Text fragment links only work for text. To point at a button, chart or image, pin a comment on it with an extension like Lasso and share the comment's link, which opens the page at that exact spot.
Do text links work in Slack, email and Google Docs?
Yes. They're ordinary links, so you can paste them anywhere. The highlight happens when the person opens the link in a browser that supports it.
Can I highlight more than one passage with one link?
Yes. Add another text= part to the fragment, separated by an ampersand, and the browser highlights each match. Most people find two separate links clearer.
Will the link break if the page is edited?
It can. The link matches exact words, so if those words change, the page opens normally without the highlight. Choose a phrase that's unlikely to be rewritten, like a heading or a product name.
