Live Preview · 9 Formats · Zero Uploads

Video to Base64 Encoder

Drop any video file and instantly get a Base64 string, data URI, and ready-to-paste HTML5 video tag, JavaScript, and Python snippets with a live in-browser preview. Nothing ever leaves your browser.

MP4 WebM OGG MOV AVI MKV MPEG 3GP FLV
🎬

Drop a video here or click to browse

Supports MP4, WebM, OGG, MOV, AVI, MKV, MPEG, 3GP and more

MP4WebMOGG MOVAVIMKV MPEG3GPFLV
Reading video…
⚠️ Large file detected. Base64 encoding video files above 5 MB is not recommended for inline HTML embedding consider using a hosted URL instead. You can still copy or download the Base64 output for API use.
🎬
File name
MIME type
Duration
Dimensions
Original size
Base64 size
Overhead
OriginalBase64 (+~33%)
Raw Base64 0 chars
Data URI 0 chars
9+
Video Formats
4
Code Snippets
0ms
Server Latency
100%
Private & Secure

Convert a Video to Base64 in Three Steps

No sign-up, no server uploads. Drop, encode, and copy in seconds.

1

Drop or Browse Your Video

Drag any video file onto the drop zone or click to open a file picker. MP4, WebM, OGG, MOV, AVI, MKV, MPEG, 3GP, and FLV are all supported. The file is read entirely in your browser nothing is uploaded to any server.

2

Instant Base64 Encoding

The browser reads the raw video bytes using FileReader.readAsDataURL() and encodes them to Base64. The MIME type is auto-detected from the file and used to build a complete data:[mime];base64,… URI. Duration and dimensions are extracted from the in-browser preview.

3

Copy a Snippet or the Raw String

Copy the raw Base64 or full data URI, download as .txt, or switch to the Snippets tab to grab a ready-to-paste HTML5 <video> tag, JavaScript Blob + createObjectURL(), Python base64.b64encode(), or curl API payload snippet.

Everything You Need to Encode Videos

A complete video encoding toolkit with live playback preview, MIME detection, duration, dimensions, size analysis, and snippet generation.

🎬

9+ Video Formats

Encode MP4, WebM, OGG, MOV, AVI, MKV, MPEG, 3GP, FLV, and any other format your browser can read. The MIME type is auto-detected from the file and embedded in the data URI prefix and all generated snippets.

▶️

Live Video Preview

After upload, the video plays back in-browser with full playback controls. Duration, video dimensions (width × height), MIME type, original file size, Base64 size, and size overhead percentage are all displayed live.

💻

4 Developer Snippets

One-click copy for: HTML5 <video> tag with Base64 src, JavaScript Blob + URL.createObjectURL() (memory-efficient for large files), Python base64.b64encode(), and a curl JSON payload all pre-filled with your encoded video.

📊

Size Overhead Report

A visual size comparison bar shows the original video file size vs. the Base64 output side by side. The exact overhead percentage is calculated so you can decide whether inline embedding or an API payload is the right approach for your file size.

⚠️

Large File Warning

Videos above 5 MB trigger an automatic warning banner. Base64-encoded video strings can be extremely large a 10 MB MP4 becomes ~13.7 MB of Base64 text and are generally impractical for inline HTML embedding. The tool still encodes the file; the warning helps you decide how to use the output.

🔒

100% Private

All encoding uses FileReader.readAsDataURL() a native browser API. Your video bytes never leave your device. Safe for proprietary footage, confidential recordings, internal training videos, and unreleased content.

Video Format Reference

MIME types, extensions, browser playback support, and best use cases for all supported video formats.

FormatMIME TypeExtensionBrowser PlaybackBest For
🎬MP4 (H.264)video/mp4.mp4, .m4vUniversalWeb delivery, HTML5 video, social media, API payloads
🌐WebM (VP8/VP9)video/webm.webmChrome, Firefox, EdgeOpen-source web video, smaller than H.264 at same quality
🎙OGG (Theora)video/ogg.ogv, .oggFirefox, ChromeOpen-source video, legacy HTML5 video fallback
🎞QuickTime MOVvideo/quicktime.movSafari, ChromeApple ecosystem, high-quality recording, Final Cut exports
📹AVIvideo/x-msvideo.aviLimitedLegacy Windows video, archival footage
🎟MKV (Matroska)video/x-matroska.mkvChrome, EdgeMulti-track container, high-quality archival, subtitles
📺MPEGvideo/mpeg.mpeg, .mpgLimitedLegacy broadcast, DVD-era video
📷3GPvideo/3gpp.3gpMobile, ChromeMobile video, low-bandwidth streaming
🎙FLVvideo/x-flv.flvLegacy onlyLegacy Flash video encoding still works for API use

When You Need a Video as Base64

Encoding videos as Base64 solves specific problems in API design, self-contained documents, email, and developer tooling.

01

AI & Computer Vision API Payloads

Video understanding APIs including Google Video Intelligence, AWS Rekognition Video, and multimodal LLM APIs accept short video clips as Base64-encoded strings in JSON request bodies. Encode a clip here and paste the Base64 string directly into your API request, Postman collection, or curl command, eliminating the need for a temporary file upload step during development and testing.

02

Inline Video in Self-Contained HTML

When building a truly portable HTML file an offline report, kiosk display, or standalone demo you can embed a short video clip directly in the HTML using <video src="data:video/mp4;base64,…">. The resulting .html file contains every asset and plays identically without a web server or internet connection. This technique is practical only for short clips (under 1–2 MB).

03

Automated Testing & Snapshot Fixtures

Video processing pipelines and media testing frameworks often need deterministic video inputs in their test suites. Base64-encoding short test clips and storing them directly in test fixture files or JSON test cases eliminates external file dependencies, makes tests fully self-contained, and ensures the exact same binary input is used across every CI environment and developer machine.

04

Email Attachments via API

Email service APIs (SendGrid, Mailgun, AWS SES, Postmark) accept attachments as Base64-encoded content in JSON request bodies. For short video clips product demos, personalized messages, or short explainer videos you can encode the file here and paste the Base64 string directly into the API attachment object's content field, without writing the file to disk or maintaining temporary storage.

05

JavaScript Blob Playback Without a Server

In browser-based applications, you can create a playable video without hosting a file using URL.createObjectURL(blob) from a Base64-decoded Uint8Array. This pattern is used in Service Worker offline caching, Electron desktop apps, and web-based media editors where video assets need to be bundled into the application bundle rather than fetched from a remote server.

06

Database & Document Store Persistence

Some application architectures store small video assets (thumbnail previews, short looping backgrounds, animated icons) alongside structured data in document-oriented databases like MongoDB or PostgreSQL's JSONB columns. Base64 encoding ensures the video is stored as a plain text string that is portable across any database export, JSON dump, or REST API response without binary encoding concerns.

Video to Base64 Encoding Explained

Video files are binary data sequences of bytes representing compressed frames, audio tracks, codec metadata, and container headers. Base64 encoding converts this binary data to printable ASCII text by mapping every 3 bytes to 4 characters from a 64-character alphabet, producing output approximately 33% larger than the source file.

The browser's FileReader.readAsDataURL() API reads the video file and returns a complete data URI in the format data:[mime-type];base64,[encoded-data]. The MIME type is determined from the file object's type property, which the browser infers from the file extension and internal byte signature.

For playback, the data URI is set directly as the src attribute of an HTML <video> element, which works in most modern browsers for supported formats. For large files, the Blob + URL.createObjectURL() approach is far more memory-efficient because it avoids holding the entire Base64 string in the DOM as an attribute value.

// Video file → Base64 data URI
 
const reader = new FileReader();
 
reader.onload = (e) => {
  const uri = e.target.result;
  // "data:video/mp4;base64,AAAAIG…"
 
  // Inline HTML5 video:
  video.src = uri;
 
  // Or Blob (memory-efficient):
  const b64 = uri.split(',')[1];
  const bytes = Uint8Array
    .from(atob(b64), c =>
      c.charCodeAt(0));
  const blob = new Blob([bytes],
    { type: 'video/mp4' });
  video.src =
    URL.createObjectURL(blob);
};
reader.readAsDataURL(file);

Frequently Asked Questions

Everything you need to know about encoding video files to Base64.

Base64 encodes every 3 bytes as 4 ASCII characters, producing output approximately 33% larger than the original binary file. A 10 MB MP4 becomes roughly 13.7 MB of Base64 text. Video files are already highly compressed by codecs like H.264 and VP9, so unlike images there is no further compression possible the full 33% overhead always applies. For large videos, using a hosted URL with a CDN is far more efficient than embedding as Base64.
There is no hard limit enforced by this tool, but practical limits apply quickly for video. FileReader.readAsDataURL() holds the entire file and its Base64 string in browser memory simultaneously. For a 10 MB video this requires ~24 MB of RAM. The resulting Base64 string is also too large to use as an HTML src attribute in most browsers, and will cause serious performance issues in the DOM. For files above 5–10 MB, use the Base64 output for API payloads only not for inline HTML embedding.
No. The entire encoding process uses the browser's native FileReader API. Your video bytes are read directly from your local disk into browser memory no network request is made and nothing is sent to any server. The tool works fully offline after the initial page load, making it safe for proprietary footage, confidential recordings, internal training videos, and unreleased content.
Use the full data URI as the src attribute of a <video> element: <video src="data:video/mp4;base64,AAAA…" controls></video>. This works in modern browsers for short clips. For longer videos, the Blob approach is more memory-efficient: decode the Base64 back to bytes, create a Blob, and use URL.createObjectURL(blob) as the src. Both approaches are shown pre-filled in the Snippets tab.
The Base64 size is always approximately 33% larger than the source file, regardless of format. So the smallest Base64 output comes from the format with the smallest source file for your specific video content. For web use, H.264 MP4 and VP9 WebM produce the most compact files at equivalent quality. HEVC (H.265) can be smaller than H.264 but has limited browser support. AVI, MPEG, and FLV are generally much larger for the same content and should be converted before encoding if size is a concern.
No. CSS background-image and other CSS properties that accept url() values support only image MIME types not video. You cannot use a Base64 video data URI as a CSS background. To use a looping video as a background effect in a web page, use an HTML <video> element with autoplay, loop, and muted attributes, positioned with CSS, and use a small Base64-encoded MP4 or WebM as its src.
Browser video playback support varies by format and operating system. MOV (QuickTime) files play in Safari and Chrome on macOS but may not play in Firefox or Chrome on Windows/Linux. AVI, MKV, and FLV have limited native browser support. The Base64 encoding still works correctly regardless of whether the browser can play the preview the output is a valid Base64 string of the file's bytes. The preview uses the browser's native <video> element, so playback depends entirely on the browser's built-in codec support.
The tool auto-detects the MIME type from the uploaded file. The most common types are: MP4 → video/mp4, WebM → video/webm, OGG → video/ogg, MOV → video/quicktime, AVI → video/x-msvideo, MKV → video/x-matroska, MPEG → video/mpeg, 3GP → video/3gpp. The MIME type is automatically included in the data URI prefix and in all generated code snippets.