The simplest way to link to a video

To create a link to a video, you need the video's URL and HTML code that tells a browser to open it. The method depends on where the video lives: on your own server, on a platform like YouTube or Vimeo, or in cloud storage. For a video file you host yourself, you write an anchor tag with the file path. For videos on third-party platforms, you copy the embed code or share link they provide.

The fastest route is usually a simple link — just a URL that opens the video in a browser or media player when clicked. If you want the video to play directly on your page without the visitor leaving, you embed it instead, which requires different code depending on the platform.

Key Takeaways

  • A basic link to a video file uses an anchor tag with the video URL: <a href="video.mp4">Watch the video</a>
  • YouTube and Vimeo provide embed codes you paste into your page; do not write the code yourself for these platforms.
  • Self-hosted videos need a video tag with a source element to play directly on your page: <video><source src="video.mp4"></video>
  • Video file size and format matter — MP4 works in most browsers, but check your hosting provider's limits before uploading.
  • Linking to a video and embedding a video are different; linking sends visitors away, embedding keeps them on your page.

Creating a simple link to a video file

If you have a video file on your server or in cloud storage, the simplest approach is a text link. Use an anchor tag with href pointing to the video's URL. When someone clicks the link, their browser opens the video in a media player or downloads it, depending on the browser and file type.

The code looks like this:

<a href="https://yoursite.com/videos/demo.mp4">Watch the demo</a>

Replace the URL with your actual video path and the link text with whatever you want visitors to see. This method works for MP4, WebM, Ogg, and other video formats, though MP4 has the broadest browser support. The visitor's browser decides what happens — some will play it inline, others will download it.

Embedding a video directly on your page

If you want the video to play on your page without sending visitors elsewhere, use the HTML5 video tag. This embeds a media player right into your content.

The basic structure is:

<video width="640" height="360" controls> <source src="https://yoursite.com/videos/demo.mp4" type="video/mp4"> Your browser does not support the video tag. </video>

The controls attribute adds play, pause, and volume buttons. The width and height set the player size. The type attribute tells the browser what format to expect. If you want the video to start playing automatically, add autoplay; add muted if you use autoplay, because most browsers block autoplay with sound.

You can include multiple source elements with different formats to support older browsers:

<video width="640" height="360" controls> <source src="demo.mp4" type="video/mp4"> <source src="demo.webm" type="video/webm"> Your browser does not support the video tag. </video>

Linking to videos on YouTube or Vimeo

For videos hosted on YouTube or Vimeo, do not write your own embed code. These platforms provide the code for you, and using their code ensures the video plays correctly and they can track views.

On YouTube, click Share below the video, then Embed. Copy the iframe code provided — it looks like <iframe width="560" height="315" src="https://www.youtube.com/embed/VIDEO_ID"></iframe>. Paste it directly into your page's HTML where you want the video to appear. Do not modify the src URL or the video may not load.

On Vimeo, click the Share button, select Embed, and copy the iframe code. The process is identical — paste it into your page as-is. Both platforms handle responsive sizing and player features through their embed code, so customizing it yourself often breaks functionality.

If you only want to link to the video rather than embed it, use the video's public URL: <a href="https://www.youtube.com/watch?v=VIDEO_ID">Watch on YouTube</a>. This opens the video on YouTube's site instead of playing it on your page.

Hosting video files on your own server

Hosting video on your own server means uploading the file and linking to it from your page. Most web hosting providers set file size limits — check yours before uploading. Video files are large; a five-minute 1080p video in MP4 format is often 500 MB to 1 GB.

Use SFTP or your hosting provider's file manager to upload the video to a folder on your server. Then reference that path in your link or video tag. If your video is at yoursite.com/media/videos/demo.mp4, your code would be:

<video controls> <source src="/media/videos/demo.mp4" type="video/mp4"> </video>

Self-hosting gives you full control but uses your server's bandwidth every time someone watches. If you expect heavy traffic, a content delivery network (CDN) or a dedicated video platform like Vimeo Pro or Wistia may be more cost-effective.

Using cloud storage links for video

Services like Google Drive, Dropbox, and AWS S3 let you store video files and generate shareable links. These are useful if you do not have web hosting or want to avoid uploading large files to your server.

On Google Drive, right-click the video file, select Share, and set it to Anyone with the link. Copy the share link and modify it slightly: change the end from /view to /preview to embed it, or leave it as-is to link to it. The link format is https://drive.google.com/file/d/FILE_ID/view.

Dropbox share links work similarly — right-click the file, select Share, copy the link, and change the end from ?dl=0 to ?dl=1 to force download or preview instead of opening the Dropbox viewer. For embedding, Dropbox is less reliable than self-hosting or YouTube, so a simple link is usually better.

AWS S3 and other cloud storage require more setup but offer better performance and control over access. If you use these services, their documentation explains how to generate public URLs and embed codes.

Video formats and browser compatibility

Not all browsers support all video formats. MP4 (H.264 codec) works in every modern browser and is the safest choice. WebM works in Chrome, Firefox, and Edge but not Safari. Ogg works in Firefox and Chrome but is less common.

If you are embedding a video on your own page and want maximum compatibility, include both MP4 and WebM sources:

<video width="640" height="360" controls> <source src="demo.mp4" type="video/mp4"> <source src="demo.webm" type="video/webm"> Your browser does not support the video tag. </video>

The browser will use the first format it understands. For most projects, MP4 alone is sufficient. If you need to convert a video to a different format, tools like FFmpeg (command-line) or HandBrake (graphical interface) can do it for free.

Frequently Asked Questions

Can I link to a video without hosting it myself?

Yes. You can link to videos on YouTube, Vimeo, or other platforms using their public URLs, or you can use cloud storage links from Google Drive or Dropbox. You only need to host the video yourself if you want it embedded on your page and do not want to use a third-party platform.

What is the difference between linking and embedding?

A link is a URL that opens the video in a new tab or downloads it. Embedding means the video player appears directly on your page. Embedding keeps visitors on your site; linking sends them away. YouTube and Vimeo provide embed codes; self-hosted videos use the video tag.

How do I make a video responsive so it resizes on mobile?

For YouTube or Vimeo embeds, wrap the iframe in a container div with padding-bottom set to the aspect ratio (56.25% for 16:9). For self-hosted videos, use CSS to set max-width to 100% and height to auto. YouTube and Vimeo embeds often handle this automatically if you use their provided code.

What video format should I use?

MP4 is the standard — it works in all modern browsers and most devices. If you need broader compatibility or smaller file sizes, also provide a WebM version. Avoid Ogg and other older formats unless you have a specific reason to support very old browsers.

Can I autoplay a video with sound?

Most browsers block autoplay with sound to prevent annoying visitors. You can autoplay with the video muted, then let visitors unmute it manually. Add both autoplay and muted attributes: <video autoplay muted>. This works across browsers.