ForHosting KIT · Developer Utilities

Semitones between frequencies calculator

The semitones between frequencies calculator converts any two positive frequencies into their signed musical distance in twelve-tone equal temperament.

● BetaFree · in your browser
Use it from WebAPIEmailTelegramApp soon

Enter a starting frequency and an ending frequency in hertz, and it evaluates twelve times the base-two logarithm of their ratio. The result can describe familiar octave and interval relationships as well as fractional semitone differences used in tuning, acoustics, instrument measurement, audio analysis, and pitch correction. It also returns the frequency ratio and clearly indicates whether the second frequency lies above, below, or exactly at the first.

Enter the frequencies in the intended order

Provide frequency_1_hz as the reference or starting pitch and frequency_2_hz as the pitch you want to compare with it. Both values must be positive finite numbers expressed in hertz. Their order matters because the answer is signed: 440 Hz followed by 880 Hz produces a positive twelve-semitone interval, while 880 Hz followed by 440 Hz produces negative twelve semitones. Equal inputs produce zero semitones and a direction of unison. Decimal frequencies are welcome, so measured peaks such as 439.7 Hz or theoretical values such as 261.625565 Hz can be compared directly. Do not enter note names, wavelength values, cents, or ratios in these fields; convert them to frequencies first. The response repeats both accepted inputs, making it straightforward to keep a calculation attached to its source measurements in a worksheet, test fixture, or analysis log. Validation rejects zero, negative values, missing fields, numeric strings, infinity, and nonnumeric data rather than allowing an undefined logarithm to become a misleading result.

Understand the logarithmic calculation

The calculator first divides the ending frequency by the starting frequency, then takes the base-two logarithm of that ratio and multiplies it by twelve. This follows the structure of twelve-tone equal temperament: doubling a frequency raises pitch by one octave, log2(2) equals one, and twelve times one equals twelve semitones. A ratio of one has a logarithm of zero, so identical frequencies are unison. Ratios below one have negative logarithms and therefore describe downward motion. Unlike a note-name interval table, this method is continuous. It can return 7.01955 semitones for a slightly wide fifth or 0.23 semitones for a small tuning deviation, rather than forcing every observation onto an integer keyboard step. The response rounds ratio and semitones to twelve decimal places to keep serialized output stable while retaining far more precision than most practical frequency measurements justify. The formula and temperament fields make the convention explicit, which is useful when results move between software that may otherwise assume cents, just intonation, or another tuning system.

Interpret and apply the signed result

Read the semitones field as the directed distance from the first frequency to the second. Positive means the second is higher, negative means it is lower, and zero means the frequencies match. The direction field expresses the same relationship as up, down, or unison for interfaces that should not infer meaning from a sign. Integer answers identify exact equal-temperament steps: twelve is an octave, seven is a perfect fifth in the equal-tempered grid, and one is a semitone. Fractional answers are often the important part when checking an instrument, comparing spectral peaks, or estimating a pitch-shift control setting. To express the answer in cents, multiply the returned semitone value by one hundred; that conversion is not performed automatically, so the output contract remains focused. For repeatable automation, retain the original measurement precision and avoid rounding the input frequencies before calling the calculator. Successful API requests use the published base price of $0.002 per item, while the browser version runs the same deterministic calculation locally. No frequency data is sent to a third-party service, and repeated identical inputs always produce identical JSON output.

Measure instrument tuning

Compare a measured fundamental with its target frequency and quantify the signed deviation in fractional semitones.

Configure a pitch shift

Calculate the semitone setting needed to move recorded audio from one known frequency to another.

Analyze spectral peaks

Convert the ratio between two detected frequency peaks into an interval that musicians and audio tools can interpret.

What formula does the calculator use?

It uses semitones = 12 × log2(frequency_2_hz / frequency_1_hz), the standard relationship for twelve-tone equal temperament.

Why can the result be negative?

A negative result means the second frequency is lower than the first. Reverse the inputs to obtain the same magnitude with the opposite sign.

Can the result contain a fraction of a semitone?

Yes. Arbitrary frequency ratios rarely land exactly on equal-temperament steps, so fractional semitone results are expected and useful.

How do I convert the answer to cents?

Multiply the semitones value by 100. One equal-temperament semitone equals 100 cents.

What inputs are invalid?

Missing, zero, negative, infinite, nonnumeric, and string values are rejected. Both frequencies must be positive finite JSON numbers in hertz.

What does an API request cost?

Each successful API request costs $0.002 per item. The same deterministic calculation is free in the browser.

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/optics/semitones-between-frequencies

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/optics/semitones-between-frequencies \
  -H "Authorization: Bearer $KIT_KEY" \
  -H "Content-Type: application/json" \
  -d '{"frequency_1_hz":440,"frequency_2_hz":880}'
{
  "frequency_1_hz": 440,
  "frequency_2_hz": 880
}
{
  "task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
  "type": "optics.semitones_between_frequencies",
  "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.

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.

Read the full KIT documentation →