Harmonic Interval Calculator
What this calculator does
This calculator finds the interval between two MIDI note numbers. Enter one MIDI value in the first field, another in the second field, and the result panel reports the absolute semitone distance along with the common interval name that matches that distance inside a single octave. In practical terms, it answers questions like: “How far apart are these pitches?”, “Is this a major third or a perfect fifth?”, and “If the notes are more than an octave apart, what is the simple interval underneath that wider span?”
That makes the tool useful in several musical workflows. If you compose with a piano roll or DAW, MIDI numbers are often the fastest way to describe notes without worrying about staff notation. If you teach or study ear training, you can use the calculator to connect raw pitch movement to interval names. If you program music software, write generative scripts, or inspect MIDI data exported from another application, the calculator gives you a quick, readable interpretation of the relationship between two pitches.
Although the page says “harmonic interval,” the math works for both harmonic and melodic contexts. The calculator simply compares two pitch values. If the notes sound at the same time, the result describes a harmonic interval. If they occur one after another, the same semitone distance can describe a melodic leap. What changes is the musical context, not the arithmetic.
How to read the inputs
Both fields expect MIDI note numbers from 0 through 127. In the General MIDI convention, 60 is middle C, 61 is C♯/D♭, 62 is D, and so on upward by semitone steps. Because MIDI numbers are evenly spaced, every increase of 1 means one semitone higher. Every increase of 12 means one octave higher. That regular structure is why MIDI is perfect for quick interval calculations: once you know the two numbers, the distance between them is just subtraction.
The calculator uses the absolute value of the difference, so order does not matter for the reported size. Entering 60 and 67 gives the same semitone count as entering 67 and 60. That is intentional. This page is focused on interval size rather than direction, so it does not label one version as ascending and the other as descending. If you need directional analysis for melodic contour, keep track of which note came first outside the calculator.
It is also worth noting what MIDI does not encode. A MIDI number tells you pitch height, but it does not tell you whether the note should be spelled as C♯ or D♭, or whether a six-semitone gap should be thought of as an augmented fourth or diminished fifth. Because the spelling information is absent, the calculator returns a pitch-distance name such as “tritone” rather than a notation-specific enharmonic label.
The formula behind the result
The core computation is straightforward. Let n1 be the first MIDI note number and n2 be the second. The total distance in semitones is the absolute difference between those values:
To identify the simple interval class within one octave, the calculator reduces that distance modulo 12. In plain language, it asks for the remainder after removing complete octaves:
If d is 7, the result is a perfect fifth. If d is 19, the simple interval is still 7 semitones, so the page reports a perfect fifth plus one octave. This is a practical, DAW-friendly way to present compound intervals without forcing note-spelling rules that MIDI cannot supply on its own.
More abstractly, every calculator can be described as a function that maps inputs to an output. The interval calculator is a very simple example of that broader idea, which is why the general mathematical view below still applies:
For this specific tool, the function is much simpler than in a weighted financial or engineering model. Still, it is useful to recognize the pattern: gather inputs, apply a deterministic rule, and produce an output that can be checked and repeated. The following preserved formula is a common generic template for many calculators, even though this interval tool does not need weighted summation itself:
Here, that broader notation mainly serves as a reminder that calculators become trustworthy when the meaning of each variable is clear. For this page, the variables are simply two MIDI note numbers and the logic that compares them.
Semitone names used by the calculator
The page names intervals according to their semitone count inside one octave. This is the same mapping used by the script, so the labels in the table below match the output exactly. When the total span exceeds 12 semitones, the result combines one of these simple names with an octave count.
| Semitones | Interval name | Typical musical feel |
|---|---|---|
| 0 | Unison | Same pitch class, no distance within the octave |
| 1 | Minor second | Tight, tense, highly dissonant |
| 2 | Major second | Stepwise motion, common in scales and melodies |
| 3 | Minor third | Common in minor chords and expressive melodic shapes |
| 4 | Major third | Bright chord-defining interval in major harmony |
| 5 | Perfect fourth | Stable but open, often used in suspensions and quartal sounds |
| 6 | Tritone | Balanced instability, famously tense and attention-grabbing |
| 7 | Perfect fifth | Strong, consonant, foundational in power chords and tuning |
| 8 | Minor sixth | Warm but slightly dramatic |
| 9 | Major sixth | Broad, lyrical, often pleasantly open |
| 10 | Minor seventh | Colorful, bluesy, and common in seventh chords |
| 11 | Major seventh | Close to the octave and rich with tension |
| 12 | Octave | Same pitch class in a higher or lower register |
One subtle detail is the treatment of exact octaves and larger compound spans. If the distance is exactly 12 semitones, the result is simply “Octave.” If the distance is 24 semitones, the script reduces the simple interval to 0 and shows “Unison + 2 octave(s).” That phrasing is consistent with the page logic: once complete octaves are removed, the pitch class is the same again.
Worked examples
Suppose you enter 60 for the first note and 67 for the second. The difference is 7 semitones, so the result is a perfect fifth. This is one of the most recognizable consonant intervals in tonal music. In chord writing, that span is the backbone of open fifths and power-chord textures. In arranging, it tells you the upper note sits far enough away to feel stable without being too dense.
Now try 60 and 64. The distance is 4 semitones, so the calculator reports a major third. That interval is one of the notes that defines a major triad. A quick check like this is handy when you are editing MIDI clips and want to confirm whether a stacked note is giving you major color, minor color, or something more ambiguous.
For an octave example, enter 52 and 64. The difference is 12 semitones, so the result is an octave. The two notes share the same pitch class even though they are in different registers. This is especially useful when you double a bass line or melody one octave higher and want to verify the spacing numerically rather than by ear alone.
Finally, consider a compound interval such as 45 and 64. The difference is 19 semitones. Reducing 19 modulo 12 leaves 7, so the simple interval is a perfect fifth, and the page shows that relationship plus one octave. This is a good example of why the calculator reports both the raw semitone distance and the simplified name: the total span tells you how wide the voicing is, while the reduced interval tells you the harmonic class inside the octave.
When you test your own inputs, a good sanity check is to ask whether the result matches what you already know about the notes. If the numbers differ by 1, you should expect a very tight semitone clash. If they differ by 7, you should expect a fifth. If the answer surprises you, it is often because one note number was entered an octave higher or lower than intended.
How to interpret the result musically
The most immediate output is the semitone count. That tells you the exact pitch distance and is often the most useful value when editing MIDI or writing code. The interval name is the human-friendly translation. Together, they let you move between technical and musical thinking without switching tools.
If you are arranging harmony, the result helps you judge density and color. Small intervals such as minor seconds and major seconds create friction, especially in lower registers. Thirds and sixths often sound fuller and more character-defining. Perfect fourths and fifths create openness, while sevenths add tension that tends to want resolution. The calculator does not tell you whether the interval is “good” or “bad”; it gives you the distance so you can decide whether the color fits your musical goal.
If you are transcribing, the tool is useful for checking leaps. A melody that jumps 9 semitones has a very different expressive effect from one that moves by 2 semitones. Likewise, if you are debugging algorithmic composition or MIDI transformations, the result can confirm whether your script is preserving interval relationships the way you intended.
Assumptions and limitations
This calculator intentionally stays close to what MIDI can guarantee. Because it works from note numbers alone, it does not identify enharmonic spellings, staff notation, key signature context, inversion names, chord quality, or voice-leading function. A six-semitone span is reported as a tritone because that is the most honest label available from pitch distance alone.
It also treats the interval as undirected by using an absolute difference. That means it will not tell you whether the second note is above or below the first. For many harmonic tasks that is exactly what you want, because interval size matters more than direction. For melodic analysis, however, you may want to keep the sign of the subtraction separately.
Compound interval naming is simplified as well. A theorist might call 14 semitones a major ninth, but the current script expresses it as “Major second + 1 octave(s).” That wording is consistent, easy to read, and faithful to the page logic. It is especially practical in software contexts where pitch-class reduction matters more than textbook interval spelling.
In short, the calculator is best thought of as a precise MIDI distance tool with friendly musical names layered on top. Within that scope, it is fast, repeatable, and dependable.
Mini-game: Interval Lock
Want to practice the same idea in a faster, more playful way? In this optional mini-game, a glowing note races around a 12-step pitch ring. Your job is to lock the moving note onto the target interval from the highlighted root. Tap or click the canvas, or press the space bar, when the runner reaches the correct semitone position. Strong streaks come from thinking in interval classes, which is exactly what the calculator does when it reduces distances within the octave.
Optional practice mode: match the target interval from the current root and build a streak before time runs out.
