The main aim of this article is to prove the one-dimensionality of the third algebraic cohomology of the Virasoro algebra with values in the adjoint module. We announced this result in a previous publication with only a sketch of the proof. The detailed proof is provided in the present article. We also show that the third algebraic cohomology of the Witt and the Virasoro algebra with values in the trivial module is one-dimensional. We consider purely algebraic cohomology, i.e. our results are independent of any topology chosen. The vanishing of the third algebraic cohomology of the Witt algebra with values in the adjoint module has already been proven by Ecker and Schlichenmaier.