An interval is a measure of distance between two notes. The term distance (in this case) refers to musical distance (i.e. pitch). In order to properly identify an interval by name, we must know its numerical size and quality.
Numerical Size of Intervals
The numerical size of an interval can be calculated by counting the number of notes in it (including the first and last notes). For example, from C to E we form a 3rd (C-1, D-2, E-3), from C to B we form a 7th (C-1, D-2, E-3, F-4, G-5, A-6, B-7). However, not all intervals of the same numerical size have the same name. For this we need to calculate the numerical size of the interval by counting the exact number of semitones therein (remember that a semitone is just the distance between any two keys - black or white - on a keyboard).
Quality of Intervals
By using the keyboard again, we can see that intervals of the same numerical size can have a different number of semitones. For example, the 2nd between C and D has two semitones (which, you will remember, is also called a tone), while the 2nd between B and C only has one semitone. The same thing happens when you look at other intervals: For example, the 3rd between E and G has three semitones (or one and a half tones), while the 3rd between F and A has four semitones (or 2 tones). This is why we also need to know the quality of an interval before we can know its full name.
Intervals and their Names
Compound and Simple
Melodic and Harmonic
Chromatic and Diatonic Semitones
A chromatic semitone defines the distance between two notes that are a semitone apart but share the same name (e.g. B-Bb), a diatonic semitone defines the distance between two notes that are a semitone apart and have different names (e.g. F#-G).