Auto-play videos suck. They use bandwidth, and their annoying sounds get in the way when you’re listening to music and open a web page. I happen to write for a website that uses them, and it annoys me to no end. (My editors have no control over those auto-play videos, alas.)

But you can stop auto-play videos from playing on a Mac. If you use Chrome or Firefox, it’s pretty simple, and the plugins below work both on macOS and Windows; if you use Safari, it’s a bit more complex, but it’s not that hard.

For Chrome: Get the Disable HTML5 Autoplay plugin. This blocks both video and audio from playing automatically.

For Firefox: Use FlashStopper.

For Safari, there used to be an excellent plugin called ClickToPlugin, but it is no longer being updated. So to turn off autoplay videos, you need to first work in Terminal. Quit Safari, then open Terminal (it’s in /Applications/Utilities). Paste this command into the window:

defaults write com.apple.Safari IncludeInternalDebugMenu 1

Press Return, and wait a few seconds.

Quit Terminal, then launch Safari again. You’ll see a new menu called Debug. To turn off autoplay videos, choose Debug > Media Flags > Disallow Inline Video. (Some people are reporting that choosing this option causes problems playing videos on YouTube. Try Video Needs User Action, if you have this issue. It seems to do more or less the same thing.)

I’m not sure if this still works to enable the Debug menu for Safari on Windows.

With all of these tools, you can still play video or audio; you just need to click the play buttons to do so. But you will no longer be annoyed by autoplay media.

If you want to hide the Safari Debug menu, just quit Safari, then run this command in Terminal:

defaults write com.apple.Safari IncludeInternalDebugMenu 0

H/t Richard Frisch.

Update:

 If you want to display the Debug menu in Safari Technology Preview, this is the command to run:

defaults write com.apple.SafariTechnologyPreview IncludeInternalDebugMenu 1

 Here are the direct commands to activate and deactivate this feature in Safari from Terminal, without displaying the Debug menu:

defaults write com.apple.Safari WebKitMediaPlaybackAllowsInline -bool false

defaults write com.apple.SafariTechnologyPreview WebKitMediaPlaybackAllowsInline -bool false

defaults write com.apple.Safari com.apple.Safari.ContentPageGroupIdentifier.WebKit2AllowsInlineMediaPlayback -bool false

defaults write com.apple.SafariTechnologyPreview com.apple.Safari.ContentPageGroupIdentifier.WebKit2AllowsInlineMediaPlayback -bool false

Thanks to zwaldowski for posting them.

 Thanks to a commenter, here’s a link to the Disable HTML5 Autoplay Plugin for Opera.