off the top of one's head; from thin air
Used when saying or doing something without preparation, evidence, or reference; often implies improvisation or making things up on the spot.
He gave a speech off the top of his head.
from memory; by heart
Used when reciting, singing, or reproducing something entirely from memory without looking at notes or text.
She recited the long poem from memory.
He's just saying that out of thin air.