ForHosting KIT · Home, food & hobbies

Interval in cents from frequency ratio calculator

A just fifth of 1.5 measures almost 2 cents more than the 700 cents of an equal-tempered fifth: enter any positive frequency ratio and see its size in cents, octaves and semitones, upward or downward. Free in your browser.

  • Free
  • Runs in your browser
  • No sign-up
  • Your data stays on your device
Use it from WebAPIEmailTelegramApp soon
If you enter
Ratio
1.5
You get
Cents
701.9550008654 cents
Abs cents
701.9550008654
Octaves
0.5849625007
Semitones
7.0195500087

An interval-in-cents-from-frequency-ratio calculator answers the question tuners and temperament theorists actually type: how large is this interval when I already know the ratio, not two measured Hertz values. Enter a strictly positive frequency ratio r equals f2 over f1 — 2 for an octave, 1.5 for a just fifth (three-to-two), 1.25 for a just major third (five-to-four), or 1.0125 for the syntonic comma (eighty-one to eighty) — and the tool returns the signed size in cents using the closed formula twelve hundred times the base-two logarithm of r, plus the absolute interval, the size in octaves and equal-tempered semitones, and substitution steps you can recompute by hand.

What cents from a frequency ratio mean

Human pitch perception is approximately logarithmic in frequency: an octave is a doubling of frequency, not a fixed number of hertz. The cent is one twelve-hundredth of an octave, so an exact octave interval always equals twelve hundred cents no matter where it sits on the keyboard. When you already know the frequency ratio r equals f2 over f1, you do not need two Hertz readings at all.

The defining relation is cents equals twelve hundred times the base-two logarithm of r. Equivalent forms use the natural logarithm: twelve hundred times ln of the ratio divided by ln of two, which is how floating-point implementations evaluate log2 without a dedicated primitive. Positive cents mean the ratio is greater than one (an upward interval); negative cents mean the ratio is between zero and one (a downward interval); zero cents is a unison when r equals one.

Equal temperament places twelve equal semitones in each octave, so one semitone is exactly one hundred cents and a perfect fifth in equal temperament is exactly seven hundred cents. Just intonation ratios such as three-to-two produce different cent values — about seven hundred one point nine five five for a pure fifth — which is exactly why a ratio-to-cents calculator is useful when comparing tunings, building temperament tables, and measuring commas. Rejecting zero and negative ratios is mandatory: the logarithm would leave the real line.

Build just-intonation and temperament tables

Enter each scale degree as a frequency ratio (3/2, 5/4, 9/8) and record the cent size next to the equal-tempered target so singers and tuners can see the comma.

Measure commas and tempering residuals

Convert 81/80, 64/63, or 25/24 to cents and compare against a temperament’s fifth or third so you know how far a keyboard must bend a just interval.

How do I convert a frequency ratio to cents?

Send a strictly positive ratio r = f2/f1 (for example 1.5 or the string 3/2).

How many cents is a just fifth (3/2)?

A frequency ratio of 1.5 (three-to-two) is about 701.955 cents. Equal temperament’s fifth is exactly 700 cents, so the just fifth is roughly 1.955 cents wider.

Should I enter two frequencies or one ratio?

Use this tool when you already have the ratio (just intervals, scale tables, commas). If you measured two pitches in hertz, use a cents-between-frequencies calculator instead.

How do I measure the syntonic comma in cents?

Enter 1.0125, which is 81/80, and read its size in cents. Compare that value with a temperament's fifth or third to see how far a keyboard has to bend a just interval.

What does a negative cents result mean?

It means the ratio is between zero and one, so the interval goes downward. A ratio above one gives positive cents, an upward interval, and a ratio of exactly one is a unison.

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.

POSThttps://api.kit.forhosting.com/hobby/music-ratio-to-cents

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.

curl -X POST https://api.kit.forhosting.com/hobby/music-ratio-to-cents \
  -H "Authorization: Bearer $KIT_KEY" \
  -H "Content-Type: application/json" \
  -d '{"ratio":1.5}'
{
  "ratio": 1.5
}
{
  "task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
  "type": "hobby.music_ratio_to_cents",
  "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.

Per request$0.002

Published price — no tokens, no invented credits. A failed task is never charged.

max_abs1000000000000
min_ratio1e-12
HTTPCodeMeaning
401unauthorizedMissing or invalid API key.
402insufficient_balanceYour balance doesn't cover the task price.
404unknown_typeThat task type doesn't exist.
429rate_limitedToo many requests. Use the webhook instead of polling.

Zero or negative ratios are rejected with invalid_input, because log2 is not defined on the non-positive reals.

How to call the API and what comes back

Typical values are 2 for an octave, 1.5 for a just fifth, 1.25 for a just major third, and 4/3 approximately 1.333 for a just fourth. The steps array walks from the raw ratio through the log formula, the octave and semitone views, the absolute interval, and the summary line so you can assert intermediate values in tests or worksheets. Send a JSON body with one required field: ratio, a strictly positive finite number (aliases r, frequency_ratio, interval_ratio, and freq_ratio). The absolute value of the ratio must stay within the published limit of one trillion, and the value must be strictly greater than zero; missing fields, empty strings, non-numeric text, non-finite numbers, zero, and negative values return invalid_input and are never charged. On success the response echoes the rounded ratio, sets cents to the signed interval, abs_cents to the absolute value of that interval, octaves to cents divided by twelve hundred, semitones to cents divided by one hundred (equal-tempered semitone units), unit to the string cents, formula to the closed relation cents equals twelve hundred times log2 of the ratio, direction to upward, downward, or unison, and message to a short English summary. Pricing is a flat $0.002 per successful request with unit item.

Temperament analysis, limits, and related searches

For just-intonation drills, feed pure ratios such as five-to-four, six-to-five, nine-to-eight, and eighty-one-to-eighty and compare each result against the equal-tempered target of four hundred, three hundred, two hundred, and zero cents respectively; the residual is the comma or the tempering you would apply on a keyboard. This landing targets people searching for an interval in cents from a frequency ratio, a just-intonation cents calculator, or a 3/2 to cents converter; it is not a two-frequency Hertz comparator (use a cents-between-frequencies tool when you measured two pitches), not a MIDI note mapper, not a pitch detector for audio files, and not a named-interval labeler that prints fifth or major third as the primary result. Round-trip checks are straightforward: recompute twelve hundred times log2 of the ratio by hand or in a spreadsheet and confirm it equals the published cents field within twelve-decimal rounding. Keep the ratio inside the published positive range so the logarithm stays finite in IEEE double precision. Prefer sending a JSON number when you control the client; string fractions are accepted so a table of just intervals can be posted without a pre-division step. When teaching, pair a happy path such as 1.5 or 3/2 with a deliberate zero or negative ratio to demonstrate the hard invalid_input path, and confirm that sending the reciprocal of r only flips the sign of cents while abs_cents stays the same. Failed tasks that return invalid_input do not consume prepaid balance, which keeps exploratory scripts cheap when learners deliberately probe edge cases.

Unit tests for microtonal and tuning libraries

Developers assert octave, just-fifth, and syntonic-comma fixtures against deterministic cents outputs without audio hardware or two measured Hertz values.

What happens if the ratio is zero or negative?

The task fails with invalid_input. A non-positive ratio has no real base-two logarithm, so there is no interval size in cents and the call is not billed.

What does the frequency-ratio-to-cents calculator cost?

The browser tool is free. API requests use prepaid KIT balance at $0.002 per successful call; invalid input is not billed.

Read the full KIT documentation →