know (something) by heart
To have learned or memorized something completely. Ask Becky to recite the poem—she knows it by heart. I can't sing that song in front of an audience if I don't know the words by heart!
know something by heart
Fig. to know something perfectly; to have memorized something perfectly. I know my speech by heart. I went over and over it until I knew it by heart.