He graduated from the Fazekas Highschool where he was a classmate of László Lovász, Miklós Laczkovich, and Lajos Pósa. Following this he learned mathematics at the Eötvös Loránd University between 1967 and 1972. Afterwards he was a lecturer at the Analysis Department of the same university. He got his Ph.D. in 1975 and obtained the Candidate degree of the Hungarian Academy of Sciences in 1978, posthumously.
He did research in combinatorics; Baranyai's theorem on the decompositions of complete hypergraphs solved a long-standing open problem. As well as being a mathematician, Baranyai was a professional musician, who played the recorder. He died in a car accident after a concert, while touring Hungary with the Barkfark Consort.