How to Figure Out a Guitar Melody by Ear
Figuring out a melody by ear is a separate skill from figuring out chords (see [[how-to-figure-out-chords-by-ear:the article on chords by ear]]), but it starts exactly the same way - by finding the key, not by guessing the first note at random.
The key first, notes second
Knowing the key (see the article on finding the key) immediately narrows the search to one scale or pentatonic instead of all twelve notes - most pop and rock melodies fit almost entirely inside the key's minor or major pentatonic.
Sing the phrase before hunting for it on the neck
Sing or hum a short piece of the melody a few times before picking up the guitar - your voice remembers the melody's shape (up, down, a leap) more accurately than trying to pick it out on the instrument right away. Search the neck for a specific phrase you're clearly holding in your head, not a vague 'something like this'.
Search inside one pentatonic position
Most simple melodies fit inside one pentatonic shape (see the article on getting started improvising) - look for the notes there first, not across the whole neck at once. If the melody 'doesn't fit', the likely cause is a wrong key, not a melody outside the pentatonic.
Work backward from the end of the phrase
The last note of a musical phrase is almost always the key's stable, 'home' note (see the article on the feeling of home), which makes it the easiest one to find first. Move backward through the phrase from that anchor point, rather than forward from the first note, which is usually the hardest to pin down with confidence.
Check one note at a time, not the whole phrase at once
Play one guessed note along with the recording and compare - only once it's confirmed exactly right should you move to the next. Trying to pick out the whole phrase 'by eye' tends to pile up small inaccuracies that are hard to find and fix individually afterward.
Try it in practice
Open exercises