Video bitrate calculator for a target file size
This video bitrate calculator turns two practical constraints—the running time of a video and the largest file you want to deliver—into a combined bitrate budget for encoding.
Run — free
It reserves a safety margin before reporting the bitrate, which helps account for container metadata, variable-rate encoding, muxing overhead, and small differences between an encoder’s target and its actual output. Use the result as the total allowance for video plus audio, then divide that allowance between the streams in your encoder settings.
Start with duration and a real delivery limit
Enter the complete program duration in seconds and the desired final size in decimal megabytes. The calculator treats one megabyte as 1,000,000 bytes, which matches the units commonly shown by upload services and storage vendors. Duration must include everything that will be muxed into the finished file, including title cards, credits, and any appended segment. The target should be the actual delivery ceiling, not merely a rough preference. If a platform accepts files up to 100 MB, using 100 MB as the target and retaining the default safety margin produces a more practical budget than attempting to consume every theoretical bit. The raw maximum is calculated by converting megabytes to bits and dividing by seconds. This is a combined rate: video, audio, subtitles, metadata, and container overhead all draw from the same finite file-size budget. A correct duration matters greatly because even a small timing error is multiplied across the entire encode. For variable-length material, determine the final timeline first and calculate after editing is locked.
Understand what the safety margin changes
The theoretical bitrate assumes that every bit in the final file belongs to perfectly predictable media streams. Real encodes are less tidy. Containers add headers and indexes, audio consumes part of the rate, and variable-bitrate encoders may finish slightly above their requested average. The safety margin reduces the theoretical combined rate before it is returned, leaving part of the target size unused on purpose. With the default five percent margin, the calculator recommends ninety-five percent of the mathematical maximum. Increase the margin when a hard upload rejection would be costly, when the encoder is known to overshoot, or when the output includes several audio and subtitle tracks. A smaller margin may be reasonable for a tightly controlled two-pass workflow, but zero removes the buffer entirely. The result remains a combined bitrate, so subtract the rates assigned to audio and other predictable streams to find the video bitrate. For example, if the returned combined budget is 1,267 kbps and audio uses 128 kbps, the approximate video setting is 1,139 kbps. Never add audio on top of the returned budget.
Use the result in an encoding workflow
Copy the required combined bitrate into your planning sheet or encoding pipeline, then allocate it among video and audio according to the content. Dialogue-heavy material may need a modest but dependable audio allocation, while silent screen recordings can devote nearly all of the budget to video. For the closest size match, use an average-bitrate or two-pass mode rather than a quality-only mode such as constant rate factor, because quality-only modes do not promise a final size. After encoding, inspect the actual file size and media bitrates. The safety allowance should normally keep the file below the target, but an encoder, unusual container, attachment, or extra track can still change the outcome. The calculator rejects targets whose safety-adjusted combined rate falls below 100 kbps. That threshold prevents it from presenting an extremely constrained number as though it were a generally usable video plan. The rejection is not a claim that encoding below 100 kbps is technically impossible; it means the requested combination is outside this capability’s practical planning range. Shorten the program, raise the size target, or use a specialized low-bandwidth workflow.
What you can do with it
Meet an upload portal limit
Calculate an encoding budget that keeps a finished presentation below a strict file-size ceiling.
Plan email or learning-platform delivery
Choose a combined bitrate for a fixed-duration lesson before starting a long two-pass encode.
Split a bitrate budget between streams
Find the total allowance first, then subtract planned audio rates to determine the video bitrate setting.
FAQ
What does an API request cost?
Each API request costs $0.002. The browser calculator can run the same deterministic calculation locally.
Does the result include audio bitrate?
Yes. It is a combined bitrate budget. Subtract audio and any other stream allocations before setting the video bitrate.
Why use a safety margin?
A margin leaves room for container overhead, metadata, extra streams, and ordinary encoder bitrate variation.
Does MB mean 1,000,000 or 1,048,576 bytes?
This calculator uses decimal megabytes: one MB equals 1,000,000 bytes.
Why was my target rejected as too small?
After applying the safety margin, it implied a combined bitrate below the 100 kbps usable minimum. Increase the target size or reduce the duration.
For developers — API access
Everything on this page is available programmatically. This section is for teams who want to wire it into their own systems; everyone else can just use the tool above.
API endpoint
Prefer to automate it? One authenticated POST creates the task; the result comes back by webhook or a signed link. The same capability also runs here on the web, by email and from Telegram — and soon from our app too.
Call it from your stack
curl -X POST https://api.kit.forhosting.com/video/compress-target-size \
-H "Authorization: Bearer $KIT_KEY" \
-H "Content-Type: application/json" \
-d '{"duration_seconds":600,"target_size_mb":100}'const res = await fetch("https://api.kit.forhosting.com/video/compress-target-size", {
method: "POST",
headers: {
"Authorization": `Bearer ${process.env.KIT_KEY}`,
"Content-Type": "application/json"
},
body: JSON.stringify({
"duration_seconds": 600,
"target_size_mb": 100
})
});
const { task_id } = await res.json();import os, requests
res = requests.post(
"https://api.kit.forhosting.com/video/compress-target-size",
headers={"Authorization": f"Bearer {os.environ['KIT_KEY']}"},
json={
"duration_seconds": 600,
"target_size_mb": 100
},
)
task_id = res.json()["task_id"]<?php
$res = file_get_contents("https://api.kit.forhosting.com/video/compress-target-size", false, stream_context_create([
"http" => [
"method" => "POST",
"header" => "Authorization: Bearer " . getenv("KIT_KEY") . "\r\nContent-Type: application/json",
"content" => '{"duration_seconds":600,"target_size_mb":100}',
],
]));
$task = json_decode($res, true);body := bytes.NewBufferString(`{"duration_seconds":600,"target_size_mb":100}`)
req, _ := http.NewRequest("POST", "https://api.kit.forhosting.com/video/compress-target-size", body)
req.Header.Set("Authorization", "Bearer "+os.Getenv("KIT_KEY"))
req.Header.Set("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)Example request
{
"duration_seconds": 600,
"target_size_mb": 100
}Example response
{
"task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
"type": "video.compress_target_size",
"status": "queued",
"_links": {
"result": "/tasks/tsk_…/result"
}
}The API is asynchronous: the call returns a task_id immediately and the result arrives by webhook. Polling is capped at 1 req/s per task.
Pricing
Published price — no tokens, no invented credits. A failed task is never charged.
Limits
max_mb | 500 |
max_minutes | 60 |
max_megapixels | 3.9 |
Errors
| HTTP | Code | Meaning |
|---|---|---|
401 | unauthorized | Missing or invalid API key. |
402 | insufficient_balance | Your balance doesn't cover the task price. |
404 | unknown_type | That task type doesn't exist. |
429 | rate_limited | Too many requests. Use the webhook instead of polling. |