Let's say we want to tune our long-ignored guitar without a tuner, this is tuning 'by ear'. Firstly we'll need to 'Get an E' from somewhere as a reference note. This could be another instrument, a piece of software, an app or tuning fork / pitch pipe.
Play the reference E, then strike the 6th string, AKA the low E string. Is the second note higher (sharp) or lower (flat) than the first? Turn the tuning peg of the 6th string until they match.
This can take a bit of trial and error if you're new to the guitar or tuning in general. If you can no longer hear a difference but you're unsure if you're in tune, try purposefully detuning the 6th string away from E and sweeping back in. Once we have the low E on the 6th string, we can then tune the other strings in series.
Next, play the 5th fret of the 6th string. If our low E is in tune this should be an 'A'. Strike the fretted 6th string and then the unfretted (open) 5th string. Is the open 5th string sharp or flat in comparison to the fretted 6th string? Adjust the tuning peg for the 5th string and strike again. If you get lost, purposefully detune and sweep back in.
Then, simply repeat the process with the 5th fret of the 5th string (D) and then the open 4th string. Then repeat once more for the 4th and 3rd strings.
It changes a little for the 3rd and 2nd strings. Here you use the 4th fret instead (not the 5th as before).
Lastly, go back to the 5th fret for the 2nd and 1st strings.
Now keep in mind that increasing the tension on one string will subtly decrease the tension on others, shifting them away from the pitch we just put them in. Go quickly back over each string again and check they're still in tune. This effect will be especially noticeable with new strings, but it's a good habit to get into regardless. Once that's done, play a big, juicy E Major chord to make sure everything sounds great.
As mentioned earlier, if you don't have a reference note to tune from, you can always tune the guitar 'to itself'. To do that, just use this same method but don't worry about tuning the low E string to start with, just tune all the other strings in relation to it.
Check out the diagram and video below for further instruction on this technique.