AutoHotkey: Create YouTube Playlist by Copying Video Links to Clipboard

Print View Mobile View

YouTube video links follow a particular format, such as Each video has their own unique ID. We can concatenate different IDs and create a new playlist like this:,ID2,.. You can play, share, and embed this playlist just like any other playlist on YouTube. In this post, we have an AutoHotkey script that would allow you to quickly and easily create a YouTube playlist by simply copying video links to the clipboard.
YouTube Playlist

Create YouTube Playlist by Copying Video Links to Clipboard

Copy and paste below code to an AHK file and run it:

clipboard =  

playlist =


ClipChanged(Type) {
if clipboard contains,,
	StringRight, clipboard, clipboard, 11  
	gosub, doit

	playlist = %playlist%%clipboard%,
	TrayTip, Current Playlist:, %playlist% `nNumber of Videos: %count%`nUse Ctrl + Alt + Y to use playlist
	Sleep 4000
	TrayTip  ; Turn off tray tip

; Ctrl + Alt + Y : Activate script
StringTrimRight, playlist2, playlist, 1
clipboard = %playlist2%
OnClipboardChange("ClipChanged", 0)
MsgBox, 0, YouTube Playlist, Number of videos in playlist: %count% `nCurrent link: %playlist2% `n`n`nPlaylist copied to clipboard. Press Ctrl + Alt + Z to exit app.
OnClipboardChange("ClipChanged", 1)

; Ctrl + Alt + C : Clear clipboard
MsgBox, 0, YouTube Playlist - Clipboard cleared, Number of videos in playlist: %count% `n`n`nClipboard cleared.
clipboard = 
playlist =
count = 

; Ctrl + Alt + Z : Exit app

Now just press Ctrl+Alt+Y keyboard combination to start monitoring the clipboard. Then go to and copy URLs for the videos which you’d like to add to the playlist. Script works with these links:, or You’ll get a tray notification each time a URL is added to the playlist. To turn this notification off, just comment out or remove TrayTip from the script.

YouTube Playlist Notification

And when you are done, once again press Ctrl+Alt+Y to get the final playlist link for all the videos. You can paste this playlist URL into your browser to start playing or share it with anyone.


You will get a concatenated URL like this in the end:,1FJD7jZqZEk

If you make a mistake while copying, use Ctrl+Alt+C to start over. To exit the script, use Ctrl+Alt+Z. You can modify the script to use a different set of keyboard keys for any of the actions.

This handy script was originally created by Computing Tidbits here. I’ve changed it a bit to add notification title and functionality to clear clipboard.