Melodic Inversion Calculator

Melodic inversion flips every interval in a melody, so ascending becomes descending and vice versa. It is used in Bach's counterpoint, Schoenberg's twelve-tone rows, and film scores.

Enter a melody below using note names (C, D#, Bb) or integers (0-11), and choose an inversion axis.

Enter Your Melody

Format:
Use: C, C#, Db, D, D#, Eb, E, F, F#, Gb, G, G#, Ab, A, A#, Bb, B
Inversion Axis

Formula: Inverted = (2 × Axis) - Original mod 12

Try an example:

Original

—
—
Invert around 0

Inverted

—
—

Visual Comparison

See how intervals flip

Why Invert a Melody?

Counterpoint & Fugue

In some of Bach's fugues the subject comes back upside down. An ascending theme becomes descending but keeps the same intervals.

Thematic Development

Beethoven and Brahms invert motives when they develop a theme.

Twelve-Tone Technique

Schoenberg's method requires four row forms: Prime (P), Retrograde (R), Inversion (I), and Retrograde-Inversion (RI).

Film & Game Scoring

A composer can invert a character's theme to show that something has changed.

How Melodic Inversion Works

+
1

Convert Notes to Pitch Classes

Each note maps to a number 0-11, ignoring octave:

C0 C#/Db1 D2 D#/Eb3
E4 F5 F#/Gb6 G7
G#/Ab8 A9 A#/Bb10 B11
2

Choose an Axis

The axis is the point around which notes reflect. Common choices:

  • Axis 0: Standard in post-tonal analysis. C stays C, but E(4) becomes Ab(8).
  • Axis 6: Gives the same notes as axis 0, because 2 × 6 = 12, which is 0 mod 12. Both leave C and F# unchanged.
  • First note: Some composers invert around the melody's starting pitch.
3

Apply the Formula

For each note, calculate:

Inverted Pitch = (2 × Axis - Original) mod 12

The "mod 12" means you wrap around: if you get -2, add 12 to get 10 (Bb).

Worked Example: Invert C-E-G around axis 0

C (0) (2×0) - 0 = 0 → C (0)
E (4) (2×0) - 4 = -4 → 8 → Ab (8)
G (7) (2×0) - 7 = -7 → 5 → F (5)
Result: C-E-G → C-Ab-F (C major becomes F minor)
i

Intervals Flip Direction

Every interval flips direction but keeps its size.

  • An ascending major 3rd (C→E) becomes a descending major 3rd (C→Ab)
  • A leap up of 7 semitones becomes a leap down of 7 semitones
  • The melody's contour is mirrored

An inverted theme sounds related to the original because the intervals are the same, and different because every one of them moves the other way.

Famous Examples of Inversion

J.S. Bach The Art of Fugue

Contrapunctus III and IV use the subject upside down. XII and XIII are mirror fugues, in which the whole piece can be inverted.

Rachmaninoff Rhapsody on a Theme of Paganini

The melody of Variation 18 is Paganini's theme upside down, in a major key and slower.

Webern Symphony Op. 21

Built entirely on a twelve-tone row and its transformations. The row is the same backwards as forwards, transposed by a tritone.

Bartók Music for Strings, Percussion and Celesta

After the climax of the first movement, the fugue subject comes back inverted. Near the end, both forms are played together.

Video Tutorial

How to Invert Music by Hand

Everything for Post-Tonal Theory

Teaching this? Ready-made assignments →