Interval labels indicate the number of lines and spaces a written interval spans. Because they all span the three notes c1, d1 and e1 on the stave, all the intervals in example below would be described as a third, even though many of them are not sounding thirds.
There are obviously many different ways of writing the twelve sounding intervals within the octave. It is hard to imagine why one might write the last third in the example above, but there are usually practical reasons for writing the same sounding interval differently in different circumstances.
How an interval is written depends firstly on the key signature and secondly on voice-leading. The example below shows the same sounding interval (highlighted in red) written in two different ways.
eb2 is is on the way from the e2 to the d2 and in doing so it turns a C major triad into a C minor triad. It makes sense, then, that the interval marked in red is called a minor third.
the d#2 is on the way from d2 to e2. As a result the second between c2 and d2 is stretched or augmented.
There are common names for three different types of each written interval, and these are shown below. They are arranged to show which intervals are inversions of each other. In other words, if you move the top note of a major seventh down an octave, you get a minor second, as in the first example below:
If an interval consists of an octave plus one of the above intervals it is called a compound interval. A third plus an octave, for example, is a tenth but still has the distinctive third sound so is called a compound third as in the example below.