Skip to main content
AllDevToolsHub
Back to all patterns

YouTube Video ID

Extraction

Validates an 11-character YouTube video ID.

/^[a-zA-Z0-9_-]{11}$/

How it works

YouTube video IDs are 11 characters, base64url alphabet (A-Z a-z 0-9 _ -). Extract from URLs like youtube.com/watch?v=XXXXXXXXXXX or youtu.be/XXXXXXXXXXX.

Test Cases

Should Match

  • dQw4w9WgXcQ
  • jNQXAC9IVRw
  • _OBlgSz8sSM

Should NOT Match

  • dQw4w9WgXcQQ
  • dQw4w9WgXc

Quick Summary

Matches the 11-character YouTube video ID format.