YouTube Video ID Extractor
Paste any YouTube link and pull out the clean 11-character video ID, plus a canonical watch link, embed link, and thumbnail preview built from it.
About the YouTube Video ID Extractor
This tool does one job: reading a messy YouTube link and returning the plain 11-character ID underneath it, nothing else. For a standard watch link the ID is read straight from the v query parameter using the browser's own URL parser, so it doesn't matter what order the parameters come in or how many extra ones (list, index, si, t, and so on) are tacked on before or after it. For youtu.be short links, embed links, Shorts links, and the m.youtube.com mobile domain, the ID is read from the path itself instead of the query string. It's a narrower cousin of the YouTube Thumbnail Grabber below, that tool hands you downloadable image files in five sizes, this one hands you the raw ID and the handful of URLs built from it (watch link, embed link, thumbnail link) so you can drop it into an oEmbed call, an iframe, or your own script.
A more robust parsing technique than its sibling Thumbnail Grabber
This site's YouTube Thumbnail Grabber matches watch links with a hand-written regex, [?&]v=([a-zA-Z0-9_-]{11}), that scans the raw string directly. This ID extractor instead hands the whole input to the browser's real URL constructor and reads the video ID out with url.searchParams.get("v"), letting the browser's own query-string parser handle the splitting. That's a more robust technique: it correctly reads the v parameter no matter where it falls among any number of other tracking parameters, without needing a regex that anticipates every possible surrounding character.
Hostname normalization explicitly supports the mobile and privacy-embed domains
Before checking which YouTube domain a link belongs to, this tool strips a leading www. or m. from the parsed hostname, and it separately recognizes youtube-nocookie.com — the privacy-enhanced embed domain many CMS platforms and GDPR-conscious sites use — as a fully valid alternative to the standard youtube.com domain. Both of those are handled deliberately and explicitly here, rather than depending on a broader pattern happening to match them by coincidence.
One additional path format is recognized here that its sibling tool doesn't support
Alongside /embed/ and /shorts/, this extractor also recognizes YouTube's /live/ path format used for premiere and livestream links, matched with a single combined pattern: /^\/(embed|shorts|live)\/([a-zA-Z0-9_-]{11})/. The Thumbnail Grabber's separate pattern list doesn't include a /live/ case at all, making this tool the more complete of the two when it comes to the range of link shapes it correctly recognizes.
A trailing slash on the URL doesn't break the match
The extracted pathname has any trailing slashes stripped with path.replace(/\/+$/, "") before being tested against the path patterns, so a link like youtube.com/embed/dQw4w9WgXcQ/ — with an extra slash some copy-paste sources tack onto the end — still resolves correctly instead of silently failing to match because of one stray trailing character.
Four ready-made derived links are generated from the single extracted ID
Once an ID is found, the tool immediately builds a canonical watch URL, an embed URL, a shortened youtu.be URL, and a thumbnail image URL, all from that one ID, and displays them together with a live preview image. That's this tool's specific value beyond the Thumbnail Grabber: rather than offering thumbnails in five resolutions, it hands you the clean ID itself plus the handful of standard URL formats built from it, ready to drop into an iframe, an oEmbed request, or your own script.
The Copy ID button is guarded against copying an empty or stale result
The Copy ID button checks a stored currentId variable before doing anything, and does nothing at all if it's empty — which happens whenever the most recent extraction attempt failed. That prevents accidentally copying a blank value or a leftover ID from a much earlier successful extraction if the input was later changed to something invalid without re-running the extractor.
Frequently Asked Questions
Does the order of parameters in a YouTube URL matter?
No. Since the video ID is read using the browser's real URL parser rather than a fixed-position regex, extra parameters like list, index, si, or t can appear in any order or combination without affecting the result.
Does this tool support privacy-enhanced embed links from youtube-nocookie.com?
Yes. That domain is explicitly recognized as a valid alternative to the standard youtube.com domain, alongside the regular www and mobile (m.) subdomains.
Can I extract an ID from a YouTube Premiere or livestream /live/ link?
Yes. This tool recognizes the /live/ path format specifically, in addition to /embed/ and /shorts/ links.
What's the difference between this tool and the YouTube Thumbnail Grabber?
The Thumbnail Grabber focuses on giving you downloadable thumbnail images in five resolutions. This tool focuses on the clean video ID itself, plus a small set of ready-made links (watch, embed, short, and thumbnail URLs) built from that one ID.
Does a trailing slash at the end of the URL break the extraction?
No. Trailing slashes are stripped from the path before matching, so a link ending in an extra slash still extracts correctly.
Does clicking "Copy ID" copy the whole watch URL or just the ID?
Just the bare 11-character video ID. The generated watch, embed, short, and thumbnail links are shown separately for you to copy individually if needed.