Sample rate conversion ratio calculator
The sample rate conversion calculator compares a source audio sample rate with a target sample rate and returns the exact conversion relationship needed to plan resampling.
Run — free
It calculates target divided by source, identifies whether the operation increases or decreases the sampling frequency, and supplies a reduced integer ratio when both inputs are safe integers. Use it to check familiar conversions such as 44.1 kHz to 48 kHz or to validate less common rates before configuring an encoder, resampler, media pipeline, or digital signal processing workflow.
Understand the conversion ratio
A sample rate states how many discrete audio samples represent one second of a signal. When audio moves from one rate to another, the useful conversion ratio is the target sample rate divided by the source sample rate. A ratio greater than one means the destination requires more samples per second, while a ratio below one means it requires fewer. For example, converting 44,100 samples per second to 48,000 samples per second produces approximately 1.08843537414966. When both rates are safe integers, this capability also reduces them to an integer numerator and denominator. The same example becomes 160:147, a form commonly used to describe rational resampling stages. The calculator reports the original values alongside the result so downstream code can retain a clear audit trail. It treats the rates as samples per second, so both inputs must use the same unit. Entering 44.1 for one value and 48,000 for the other would describe a very different relationship, not an automatic kilohertz conversion.
Read the upsample and downsample flags
The direction fields turn the numeric comparison into an explicit decision. When the target rate is higher than the source, direction is upsample and the upsample flag is true. When the target is lower, direction is downsample and the downsample flag is true. Equal rates are reported as unchanged, with both flags false, because no rate conversion is required. These fields are deliberately redundant with the ratio: they make automation easier to read and prevent every caller from rebuilding the same comparison. Direction does not describe audio quality, bandwidth, or the specific interpolation filter that should be used. Upsampling creates additional sample positions but cannot restore frequencies that were never captured. Downsampling removes sample positions and normally requires a suitable low-pass filter before decimation to prevent aliasing. This capability calculates the relationship only; it does not process audio, choose a filter, estimate quality, or claim that a conversion is safe for a particular recording.
Use the result in an audio workflow
Use the returned ratio when planning a resampler, documenting a media transformation, validating configuration, or selecting rational interpolation and decimation factors. Integer results are especially convenient: the numerator can describe an interpolation factor and the denominator a decimation factor in a conceptual polyphase pipeline, although a production implementation may simplify or stage the work differently. Decimal rates are also accepted as long as they are finite and strictly positive, but reduced numerator and denominator fields are omitted unless both supplied rates are safe integers. That avoids presenting a misleading fraction derived from floating-point approximations. The calculation is deterministic and has no network, storage, randomness, or clock dependency, so identical inputs always return identical JSON. Rejecting zero, negative values, infinity, missing fields, and nonnumeric strings keeps configuration mistakes visible. Automated API calls cost $0.002 per request. For reliable comparisons, normalize both source and target into the same unit before calling, retain the returned direction, and let the actual audio processing system enforce its own codec and filter constraints.
What you can do with it
Configure a music resampler
Calculate the 160:147 relationship for converting 44.1 kHz source audio to a 48 kHz production pipeline.
Validate an export preset
Flag whether a requested delivery rate would upsample, downsample, or leave the source rate unchanged.
Document media transformations
Store the source rate, target rate, ratio, and direction with a processing job for later review.
FAQ
How is the resampling ratio calculated?
The target sample rate is divided by the source sample rate. A value above one is an upsample; a value below one is a downsample.
What happens when both sample rates are equal?
The ratio is 1, direction is unchanged, and both the upsample and downsample flags are false.
Does this capability resample an audio file?
No. It computes the conversion relationship only; it does not decode audio, create samples, or apply an anti-aliasing filter.
Why are numerator and denominator sometimes omitted?
They are returned only when both rates are safe integers, allowing an exact reduced integer ratio without implying false precision for decimals.
What does an API request cost?
Each API request costs $0.002.
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/audio/sample-rate-convert \
-H "Authorization: Bearer $KIT_KEY" \
-H "Content-Type: application/json" \
-d '{"source_sample_rate":44100,"target_sample_rate":48000}'const res = await fetch("https://api.kit.forhosting.com/audio/sample-rate-convert", {
method: "POST",
headers: {
"Authorization": `Bearer ${process.env.KIT_KEY}`,
"Content-Type": "application/json"
},
body: JSON.stringify({
"source_sample_rate": 44100,
"target_sample_rate": 48000
})
});
const { task_id } = await res.json();import os, requests
res = requests.post(
"https://api.kit.forhosting.com/audio/sample-rate-convert",
headers={"Authorization": f"Bearer {os.environ['KIT_KEY']}"},
json={
"source_sample_rate": 44100,
"target_sample_rate": 48000
},
)
task_id = res.json()["task_id"]<?php
$res = file_get_contents("https://api.kit.forhosting.com/audio/sample-rate-convert", false, stream_context_create([
"http" => [
"method" => "POST",
"header" => "Authorization: Bearer " . getenv("KIT_KEY") . "\r\nContent-Type: application/json",
"content" => '{"source_sample_rate":44100,"target_sample_rate":48000}',
],
]));
$task = json_decode($res, true);body := bytes.NewBufferString(`{"source_sample_rate":44100,"target_sample_rate":48000}`)
req, _ := http.NewRequest("POST", "https://api.kit.forhosting.com/audio/sample-rate-convert", body)
req.Header.Set("Authorization", "Bearer "+os.Getenv("KIT_KEY"))
req.Header.Set("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)Example request
{
"source_sample_rate": 44100,
"target_sample_rate": 48000
}Example response
{
"task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
"type": "audio.sample_rate_convert",
"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 | 200 |
max_minutes | 180 |
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. |