Scroll to Text Fragment works in Chrome 80+, Edge 83+, Firefox 131+, Safari 16.1+, Opera 67+, and Samsung Internet 13+. See the full browser compatibility.

Prince Dewani
May 6, 2026
Scroll to Text Fragment is a WICG URL directive that lets a link highlight a specific text snippet on a page through the #:~:text= syntax. It works in Chrome 80+, Edge 83+, Opera 67+, Samsung Internet 13+, Firefox 131+, and Safari 16.1+ on macOS and iOS, while Internet Explorer never added support.
This guide covers what Scroll to Text Fragment is, the browsers that support it, the syntax, how to create a link, the security restrictions, and the known issues.
Scroll to Text Fragment is a Web Incubator Community Group (WICG) URL fragment directive that scrolls a page to and highlights a text snippet specified after #:~:text= in the URL. The browser strips the directive from document.URL after parsing, so the target page cannot read it.
Scroll to Text Fragment ships in every modern engine, with Chromium browsers leading the rollout, Safari following on macOS and iOS, and Firefox arriving last. Internet Explorer and Opera Mini never implemented the directive.
Chrome supports Scroll to Text Fragment from Chrome 80 on Windows, macOS, Linux, ChromeOS, and Android. Chrome 74 to 79 had the directive disabled by default behind an Experimental Web Platform Features flag, and Chrome 73 and earlier did not support it.
Microsoft Edge supports Scroll to Text Fragment from Edge 83 on Windows, macOS, and Linux through the Chromium engine. Edge 79 to 82 had the directive disabled by default, and Edge Legacy 12 to 18 did not support it.
Firefox supports Scroll to Text Fragment from Firefox 131 on Windows, macOS, Linux, and Android. Firefox recognizes the directive, scrolls to the match, and highlights the range. Firefox 130 and earlier ignore #:~:text= and scroll to the top of the document.
Safari supports Scroll to Text Fragment from Safari 16.1 on macOS, iOS, and iPadOS. Safari 18.2 added link generation through the Share menu, so users can copy a text fragment URL directly. Safari 16.0 and earlier on macOS, and the matching iOS Safari builds, ignore the directive.
Opera supports Scroll to Text Fragment from Opera 67 on Windows, macOS, and Linux through Blink. Opera 66 had the directive disabled by default behind an experimental flag, and Opera 65 and earlier did not support it. Opera Mini does not implement the feature on any version.
Samsung Internet supports Scroll to Text Fragment from Samsung Internet 13 on Galaxy phones and tablets. Samsung Internet 12 and earlier do not parse the directive and scroll to the top of the page.
The current Chrome for Android build supports Scroll to Text Fragment from Chrome 80 on Android 5.0 and later. The legacy Android Browser shipped with Android 4.4.4 and earlier did not implement the directive and ignores any #:~:text= value on the URL.
Internet Explorer 5.5 through Internet Explorer 11 never supported Scroll to Text Fragment. Microsoft has retired Internet Explorer, so any legacy intranet that needs deep linking into a specific phrase has to fall back to id-anchor fragments or a server-rendered hash that points at a known DOM node.
Note: Scroll to Text Fragment behaves differently across Safari builds, Firefox versions, and Chromium flag states. Test it on real browsers and OS with TestMu AI. Try TestMu AI free!
The directive sits after the regular URL fragment, separated by the :~: delimiter, and the value follows the text= keyword. The browser strips :~: and everything after it from the visible URL once the page loads.
Modern browsers ship a built-in command for this; older browsers need an extension or a small script. Either path produces a regular URL you can share like any other link.
// Build a Scroll to Text Fragment URL from the current text selection.
// Paste this into the DevTools console on any page after selecting some text.
function buildTextFragmentUrl() {
const selection = window.getSelection();
if (!selection || selection.isCollapsed) {
console.log("Select some text on the page first, then run again.");
return null;
}
const phrase = selection.toString().trim();
const encoded = encodeURIComponent(phrase)
.replace(/-/g, "%2D")
.replace(/,/g, "%2C")
.replace(/&/g, "%26");
const url = window.location.origin + window.location.pathname + "#:~:text=" + encoded;
console.log("Open this URL in a new tab to jump back to the highlighted text:");
console.log(url);
return url;
}
buildTextFragmentUrl();The directive carries side-channel risk because the highlight signal can leak information about page content to the referring origin. The spec and every shipping engine apply four hard restrictions to keep that risk bounded.
The directive is stable on every modern engine, but the matching algorithm and the security boundary still produce predictable failures in production. Most issues trace back to encoding, block-level boundaries, or page mutation after publication.
In my experience, the trap that bites teams hardest is shipping text fragment links from a marketing CMS that auto-rewrites apostrophes and dashes to typographic versions on publish, which silently breaks every inbound link the moment the post goes live.
All Scroll to Text Fragment version numbers and platform notes in this guide come from these primary sources:
Did you find this page helpful?
More Related Hubs
TestMu AI forEnterprise
Get access to solutions built on Enterprise
grade security, privacy, & compliance