by heart

[by heart] {adv. phr.} By exact memorizing; so well that you remember it; by memory.

The pupils learned many poems by heart.

He knew the records of the major league teams by heart.