ForHosting KIT · Home, food & hobbies

Musical interval calculator

From C up to G is 7 semitones, a perfect fifth: enter two note names, with or without octave numbers, and get the distance in semitones, the short label and the classical interval name. 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
First note name
C
Second note name
G
You get
Pitch class a
0
Pitch class b
7
Semitones
7
Semitones descending
5

A musical interval is the pitch distance between two notes, measured in semitones on the twelve-tone chromatic scale and named with the classical labels every musician learns: perfect unison, minor second, major third, perfect fifth, tritone, octave, and the rest. This musical interval calculator accepts two note names such as C and G, F sharp and B flat, or octave-qualified pitches like C4 and A5, then returns the ascending semitone count, the short abbreviation, the full interval name, and when both octaves are supplied the absolute and directed MIDI distance.

How two note names become semitones and an interval name

Western equal temperament divides the octave into twelve equal semitones. Each note letter maps to a base pitch class: C is zero, D is two, E is four, F is five, G is seven, A is nine, and B is eleven. Accidentals shift that class by whole semitones: a sharp or the sharp symbol raises by one, a flat or the flat symbol lowers by one, and a double sharp written as x or two hash marks raises by two.

After accidentals, the pitch class is reduced modulo twelve into the range zero through eleven. The ascending interval from the first note to the second is the non-negative difference of pitch classes modulo twelve. Zero is a perfect unison, one a minor second, two a major second, three a minor third, four a major third, five a perfect fourth, six a tritone, seven a perfect fifth, eight a minor sixth, nine a major sixth, ten a minor seventh, and eleven a major seventh.

When both inputs include an octave digit such as four for middle C, the tool also computes MIDI numbers with middle C as sixty and reports the absolute semitone span plus a compound name such as perfect octave or major ninth.

Where musical interval calculators show up in real work

Music theory classes constantly assign interval identification drills, dictation answer keys, and spelling checks across enharmonic pairs; a single trusted oracle that returns both the semitone count and the classical name speeds grading and demo setup. Songwriters and arrangers sketching chord tones want quick confirmation that a melody leap is a perfect fourth or a tritone before they commit to voice-leading. Instrument builders and synthesizer patch authors encode pitch-class distances when mapping keyboards, and regression suites need fixed expected objects rather than floating musical opinions.

If you later need full chord quality analysis, scale degree functions, just-intonation ratios, or MIDI file rewriting, treat those as separate search intents and landings rather than overloading this musical interval calculator page.

Theory homework and answer keys

Generate semitone counts and standard names (P5, m3, TT, …) for textbook note pairs so teachers and auto-graders share one ground truth.

Arranging and chord-tone checks

Confirm melody leaps and inner-voice distances in semitones and classical names before committing voice-leading.

What notes can I enter?

Letters A–G with optional accidentals (#, b, x, ##, bb, ♯, ♭) and an optional octave 0–9, for example C, F#, Bb, C4, or G#5.

Is the interval ascending or the shortest path?

The complementary descending span is also returned. With octaves, absolute and directed MIDI distances are included.

How is a tritone named?

Six ascending semitones map to Tritone with short code TT (enharmonically an augmented fourth or diminished fifth).

Do enharmonic spellings matter?

Pitch class is computed from letter plus accidentals, so C# and Db share pitch class 1 and yield the same semitone distance to a fixed second note. The response still echoes your original spellings.

What does it cost?

The browser tool is free and runs locally.

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/musical-interval

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/musical-interval \
  -H "Authorization: Bearer $KIT_KEY" \
  -H "Content-Type: application/json" \
  -d '{"note_a":"C","note_b":"G"}'
{
  "note_a": "C",
  "note_b": "G"
}
{
  "task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
  "type": "hobby.musical_interval",
  "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.

Unrecognized spellings fail with a clear invalid_input error instead of inventing a bogus pitch class.

How two note names become semitones and an interval name

The pipeline is pure deterministic arithmetic: no random seeds, no wall-clock timestamps, no network calls, and no model drift, so identical note pairs always produce identical JSON. Letters outside A through G, empty strings, bare numbers, and illegal accidental characters fail early with invalid_input naming the field so clients can highlight the bad spelling without guessing.

What you send and what you get back

Each may be a bare pitch class such as C, F sharp written F#, B flat written Bb, or a double accidental such as C## or Dbb, optionally followed by an octave integer from zero through nine as in C4 or G#5. Classic checks include C to G as seven semitones perfect fifth P5, E to G as three semitones minor third m3, C to F# as six semitones tritone, and C4 to C5 as twelve semitones perfect octave. Send note_a and note_b as strings. Aliases include from, note1, and a for the first note, and to, note2, and b for the second. Missing required fields, empty strings, pure numbers, and spellings that do not match letter plus optional accidentals plus optional octave fail with invalid_input and are not charged. On success the response echoes the input strings, parsed letter accidental and pitch class for each note, semitones as the ascending zero-to-eleven distance, semitones_descending as the complementary span, interval_name and interval_short from the standard table, interval quality and diatonic number, direction, method, and formula text for tests. When both notes carry octaves the payload also includes midi_a, midi_b, semitones_absolute, semitones_directed, and absolute compound interval labels. Pricing for successful API calls is the published base of $0.002 per item; validation failures do not consume prepaid balance.

Where musical interval calculators show up in real work

Because this capability is a pure parse engine, API pricing is the published base of $0.002 per successful item and failed validation does not consume balance.

Ear-training app backends

Validate user answers on interval identification with the same deterministic table the free browser widget uses.

Read the full KIT documentation →