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.
Drop a video here or click to browse
Supports MP4, WebM, OGG, MOV, AVI, MKV, MPEG, 3GP and more
Convert a Video to Base64 in Three Steps
No sign-up, no server uploads. Drop, encode, and copy in seconds.
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.
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.
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.
| Format | MIME Type | Extension | Browser Playback | Best For | |
|---|---|---|---|---|---|
| 🎬 | MP4 (H.264) | video/mp4 | .mp4, .m4v | Universal | Web delivery, HTML5 video, social media, API payloads |
| 🌐 | WebM (VP8/VP9) | video/webm | .webm | Chrome, Firefox, Edge | Open-source web video, smaller than H.264 at same quality |
| 🎙 | OGG (Theora) | video/ogg | .ogv, .ogg | Firefox, Chrome | Open-source video, legacy HTML5 video fallback |
| 🎞 | QuickTime MOV | video/quicktime | .mov | Safari, Chrome | Apple ecosystem, high-quality recording, Final Cut exports |
| 📹 | AVI | video/x-msvideo | .avi | Limited | Legacy Windows video, archival footage |
| 🎟 | MKV (Matroska) | video/x-matroska | .mkv | Chrome, Edge | Multi-track container, high-quality archival, subtitles |
| 📺 | MPEG | video/mpeg | .mpeg, .mpg | Limited | Legacy broadcast, DVD-era video |
| 📷 | 3GP | video/3gpp | .3gp | Mobile, Chrome | Mobile video, low-bandwidth streaming |
| 🎙 | FLV | video/x-flv | .flv | Legacy only | Legacy 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.
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.
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).
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.
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.
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.
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.
Frequently Asked Questions
Everything you need to know about encoding video files to Base64.
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.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.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.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.<video> element, so playback depends entirely on the browser's built-in codec support.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.