I play the piano and I'm new to musical theory but I have a basic understanding of chords and keys. At the moment I'm looking at pop songs and trying to analyse the chords of the songs, determine the key for a song, and then try to determine the chord progression.

So for example I've got these songs

1) Rihanna - Stay,         chords in the chorus:  C  Dm Am F  
2) ATC - Around The World, chords in the chorus:  Am Em F  G

From listening and looking at the chords, I "know" (guessing really) that the first song is in C Major and the second is in A Minor, so then in Roman numerals you can write it like this (correct me if I'm wrong):

Rihanna - Stay         -> chord progression I - ii – vi - IV  
ATC - Around The World -> chord progression i -  v - VI - VII

I've collected a list of pop songs in a file and I'm working on a Python script to analyse the songs. So far the script combines all the notes from the chords, and uses that to determine the key. Also see illustration below:

enter image description here

However, for these two songs in both cases it can be either C Major or A Minor because they use the same notes. So how can I determine which key it really is? How can you say if a song is in a major or a minor key? From this example it looks like you can examine the very first chord used, but is that a good way?

  • 2
    A lot of songs in A minor will use G sharp and sometimes F sharp instead of or in addition to F natural. But then again, some songs in C major will do that too (especially F sharp).
    – phoog
    Jul 10, 2022 at 14:20
  • 1
    My previous comment should have said "...instead of or in addition to G natural and F natural."
    – phoog
    Jul 10, 2022 at 17:47

4 Answers 4


I'd actually still maintain that yes, it is possible to determine whether a piece is in a major or minor key - or no key at all - just by looking at the chords, but with the major caveat that the order and proportions of the chords can determine whether the piece is in a major key or its relative minor.

The I-V-vi-IV chord progression, depending on which of its chords plays first, lends itself particularly well to being interpreted as being in a major key or a minor key. This is because vi-IV-I-V can and will often be reinterpreted as i-VI-III-VII in the key of vi - the relative minor. In https://en.wikipedia.org/wiki/I%E2%80%93V%E2%80%93vi%E2%80%93IV_progression, note how consistently pieces with the vi-IV-I-V chord progression have minor keys for their "Recorded Key" and pieces with the I-V-vi-IV chord progression have major keys for their "Recorded Key".

Yes, this means that there can be two pieces that use the exact same set of chords (e.g. Dm, B♭ F, and C) such that one of them is in a major key and the other is in a minor key, and the only thing making one of them in a major key and the other in a minor key is the order of those chords or how often each chord is used.

Sadly, it turns out that as long as you do not know how long each chord goes for at all, you cannot unambiguously determine whether a piece is in a major or minor key. Take pieces consisting of only the chord progressions C-Dm-Am-F (all for one measure each) vs. C-Dm-Am-Am-Am-F (all for one measure each), for example. Due to how much the Am chord is stressed in the second piece, it's fairly easy to say that piece is in a minor key (A minor, in this case). However, with the first piece having all 4 of its chords in equal proportions and starting and ending with major chords (with a rough IV-I cadence to boot), the first piece is probably in a major key instead (I'd say C major). Chord progressions often repeat chords if they go on for multiple measures (a typical notation of the 12-bar blues is "I-I-I-I-IV-IV-I-I-V-IV-I-I", for example), thus often rendering concerns about the proportions of each chord moot.

The above applies more to pop music; determining the keys of classical music from their chord progressions alone actually often gives you the luxury of ignoring the end of the piece. Examples of classical music that begin in a minor key and end in their tonic major, yet are still labelled as being in that minor key, are plentiful. (One such example is Ludwig van Beethoven's Egmont Overture, which is in F minor but ends in F major. Note that IMSLP labels it as being in F minor in https://imslp.org/wiki/Egmont,Op.84(Beethoven,_Ludwig_van).) In fact, when determining the keys of classical music - or, rather, confirming the key labels of classical music - whole sections must often be ignored, such as the trios/middle sections of pieces in minuet and trio or scherzo and trio form and most of sonata-allegros (specifically, the second theme groups of the exposition and recapitulation sections along with the entire development section).

19th-20th-century marches are even worse in that regard. You often have to ignore the entire second half of the march, which possibly takes up more than 50% of the chord progression, when determining the march's key. For example, IMSLP labels John Philip Sousa's "The Stars and Stripes Forever" as being in E flat major in https://imslp.org/wiki/The_Stars_and_Stripes_Forever_(Sousa%2C_John_Philip) despite it ending in A flat major. Pieces ending in their subdominant keys is, in fact, a common feature of 19th-20th-century American marches...and 19th-20th century American ragtime. (See Scott Joplin's "Elite Syncopations" for such a ragtime example.)

Determining cadences and musical points of rest, along with which chords should end them, is a good idea, with the major caveat that you should not always rely on this.

  • This answer seems to imply that as long as C - Dm - Am - F is a correct transcription of a song's backing chords and it starts with C, then it will be impossible to make the song be perceived in any other key than C major, regardless of melody, rhythm, performance, or any other aspect. Or as an extension, as long as the backing chords and their order are known, there would only be one possible key for the song, and the key could even be unambiguously calculated without needing to know any other aspects of the song. And that just cannot be true. Jul 11, 2022 at 17:40
  • @piiperiReinstateMonica - Just tried forcing the Am chord to take up 3 measures and the rest of the chords to take up 1 measure each - you're right, that made the piece shift to A minor. Guess I'll need to change my answer as a result.
    – Dekkadeci
    Jul 11, 2022 at 17:52
  • Perception of music varies greatly between individuals. I added one more song at the end of my answer. Jul 11, 2022 at 18:36
  • I still find this wrong. The order and duration of chord symbols on a backing chord chart cannot be the sole deciding factors in how a section of actual sound can affect a listener's perception of harmony. A backing chord chart is a grossly approximated abstract description of only a part of a musical performance. The OP can figure out a key from a full performance, but wants an algorithm that takes a chord chart and prints out an unambiguous key specification that is agreed on by the whole mankind for all possible songs having that chord chart. Jul 12, 2022 at 12:39
  • @piiperiReinstateMonica - I'm still trying to think of a definitive counterexample where the melody pushes a chord progression I'd think of as being in one key (if played alone) into a different key, preferably major instead of minor or vice versa, but the closest I'm getting is that the melody consistently "plays outside" throughout and therefore both implies a different chord progression being played on top and shades doubt that the notated chord progression is correct in the first place. Think figuring that the correct chord progression is made of polychords instead.
    – Dekkadeci
    Jul 12, 2022 at 16:15

Let's see what the music21 Python library thinks about the example chord progressions.

from music21 import stream, harmony

def guess_key(chords_string):
  s = stream.Stream()
  for d in chords_string.replace('b', '-').strip().split():
      s.append(harmony.ChordSymbol(d, quarterLength=4))
  return s.analyze('key')

print(guess_key('C Dm Am F'))
print(guess_key('Am Em F G'))

The output of our program:

F major

a minor

For the A minor song, music21 agreed with you, but what's with the other one? Did the computer make a mistake, is F major wrong? Are you wrong and is Rihanna wrong? No, nobody is wrong. F major is one possible guess out of many, based on too little information.

Using different rhythmic emphasis, and the melody and depending on the listener, and even the mixing of the song, it is possible to use that exact chord sequence in a song that gets perceived by someone as being in C major or F major, and their relative minor keys Am and Dm as well.

Counter-examples that show it is not possible to determine a key from chord and pitch lists

Here is an example song with C - Dm - Am - F in F or Dm.

C - Dm - Am - F in F or Dm

And here's another song with C - Dm - Am - F, but this time in C. C - Dm - Am - F in C

I deliberately avoided using the giveaway notes B and Bb anywhere in the melodies. And it's still a subjective issue. Maybe you hear those in a different key than I did. At least Dekkadeci felt the key was still C even with this melody. I certainly didn't. But from what I can see, with this counter-example, I demonstrated that in the general case, it is not possible to "correctly" determine a key from a chord sequence. And it doesn't help even if you're given the sets of all pitches in the songs. The pitch sets are the same in both songs: C, D, E, F, G, A.

But how then do you know what key you should say the song is in?

Just like you already did - it is what it feels like to you. Saying that a song is in a key is a subjective statement. If you say "this is in A minor", it means that you personally and subjectively feel that A minor is the most prominent center-of-balance of that song's harmony, and it's the least misleading thing to say. For a lot of songs it's a compromise anyway, and in a lot of Western pop music the center of balance is not very strongly on either the major key or its relative minor key.

Personally, for most intents and purposes, I consider A minor and C major to be the same key. A person standing on two feet, sometimes their weight is slightly more on the left foot, sometimes on the right. But our language for talking about music has evolved in old times where people could only afford to wear a shoe in one foot at a time, so when we say that a person is standing, it is not possible to say that without specifying either the left or the right foot as the one that the person is standing on.

You have this question because of limitations of our language conventions. If there was an established and known way for saying "the key with C and Am being the joint center of balance without either being significantly more dominant", you would use that idiom. But there isn't, so you don't, and you have this problem.

To develop a sensitivity to this major-or-minor aspect, play existing songs and see how they have been categorized to either major or minor by more experienced people. You can only learn this by doing. It is about skill and experience, not knowledge and logic that you could calculate.

To address the literal question in the title: Is it possible to determine the major/minor key of a song by just looking at the chords?

Sometimes yes, sometimes no. If you see things like Am - Dm - B7 - E7 - Am, you can be pretty sure that it's in A minor. But even the existence of E7 - Am somewhere doesn't mean it's in A minor. Sometimes it is completely ambiguous. Sometimes the tonic chord is not even included in the song at all, the harmony goes around it without ever going "home". You have to listen to it. Here's a song that's clearly in A minor, but there is no Am chord in the whole song, not even once.

(Some theory purist / language correctness police might insist that it must be not said to be in a minor key because there's no leading tone. I say that languages evolve, and the modern de-facto meaning of "key" doesn't require a leading tone.)

Algorithms can do more, if they have more information

All that said, it is possible to get better guesses with algorithms, but you'll have to give them more than just a list of chords and a set of pitches. I took my example songs above and exported them from Sibelius a MIDI files, in different key signatures to demonstrate that Music21 is not just looking at the given key signature (in the MIDI metadata event).

The new program

from music21 import midi

def guess_midi_file_key(midi_file_name):
  mf = midi.MidiFile()
  return midi.translate.midiFileToStream(mf).analyze('key')


And the output of the program is:

F major

F major

C major

C major

Here's one of the songs imported to GuitarPro:

example song MIDI file with key signature D# minor in GuitarPro 7

So, Music21 is able to figure out that the song is in F, despite the deceptive key signature meta data. But only if it has the melody as well as the chords. I don't know what the key-guessing is based in, maybe some statistical calculation, i.e. how many times each pitch is used. I haven't tried, but I'm pretty sure it wouldn't place the Santrofi song in A minor.

By popular request, here's one more song that starts with a C chord, does not use a Bb note anywhere, and is solidly in F or Dm.

example song 4

  • 1
    I'd argue that song's in C rather than Am, but maybe more accurately, in E Phrygian, but that's just me! The pedant rises again..!
    – Tim
    Jul 10, 2022 at 14:11
  • @Tim It's not in E Phrygian, the Em chord does not sound like a resting place at all, it sounds like being away from home, it's longing to go home to mama A minor. Adding an Am at the end of the song resolves that longing, but playing a C major is a sarcastic ending which ridicules the whole story that was told before. But then again, specifying a key is a subjective statement, which is what I tried to say. Jul 10, 2022 at 14:40
  • 1
    Maybe that Em could sound like Cmaj7. There is a B played by tpt, as the last note. But, as you say, and I quite agree, deciding on a key - especially by listening, is a subjective thing, and ambiguous, and maybe many more adjectives too. I guess even composers sometimes had a hard time with it. Except maybe Bartok... But OP wants to determine merely from the notes involved, a non-starter, I reckon.
    – Tim
    Jul 10, 2022 at 14:52
  • Regarding the latest/current version of your answer, doesn't the chord progression of a full song already contain the order of the chords and, therefore, enough information to determine its key? Again, I mention in my answer that en.wikipedia.org/wiki/… has some stunning consistencies between what order the same 4 chords are in (I, V, vi, IV) and whether the piece is in a major or minor key.
    – Dekkadeci
    Jul 11, 2022 at 15:22
  • @Dekkadeci It's not about the order as such - I gave two example songs in different keys, but both songs having the exact same chords in the exact same order. It's about what notes get what kind of rhythmic importance, in the whole of the song. In my examples the rhythmic importance is set by the melody, and the melody also slightly modifies the relative weights of chord tones and adds extra notes to the total chords. For example adding D and E to an F major. But the OP's question starts from a written backing chord progression as the only source of information. Jul 11, 2022 at 15:25

The very first chord (not any anacrucis) may give the key, and often does. The very last chord usually does. (Not a lot of help for songs which fade...). But listening for cadences helps. Just examining the notes often does for major, and for minor, which generally doesn't use quite the same set as its relative counterpart. As in C major, CDEFGAB, whereas A minor ABCDEFG♯. So it's not that cut and dried.

There's the most used criterion of where does it feel 'at rest' - as if the song could finish at that point, and not give the feeling that it's just a temporary rest. But you're not going to get that neccessarily from examining notes involved. The raised leading note in a minor key is a really good clue (see G♯ in key Am). But a lot of songs may well modulate for a little while into the relative (or parallel), which throws us off the scent.

So, ears work best (as usual), except that's not what you want to use for your analysis. Thus there's often going to be that 50:50, which isn't a lot of help with the diagnosis! And that's before 'stray' notes creep in due to momentary modulation, which happens in so many songs. By the time you've tried to analyse a few hundred songs - and got 80% correct - you'll appreciate there's no particular scientific way to determine. Sorry!

One that always gets me is Fly Me To the Moon: starts off with Am, but ends on C major - so is it in A minor or C major? And I guess it's purely academic, as the same key signature is used for both. The jury's still out...


"Is it possible to determine the major/minor key of a song by just looking at the chords?"

Sometimes 'what scale includes the notes of all the chords, is the first/last chord major or minor' will give a useful answer.

But I'm afraid that a WHOLE LOT of times it won't. And if I tried to list all the ways a piece of music might not derive all its chords from just one scale, or might not even be firmly in any particular major or minor key at alland , we'd be here for the rest of our lives!


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.