Off the top of your head
"(I)f you say something off the top of your head, you say it without thinking about it for very long or looking at something that has been written about it 'What was the name of that plumber you used?' 'I couldn't tell you off the top of my head.' Off the top of my head I could probably only name about three women artists."
As you can see, "Off the top of my head" does not mean you have learned something by heart. It means you are giving a guess, giving an estimate to the best of your knowledge. It is not "saber de cór".
If "you have something down pat", you have learned something by heart or by repetitive practice and you can do it or say it perfectly. The expression is not 100% interchangeable with "to learn/know by heart", but it's close.
Ref. The Free Dictionary