We establish a structure theorem analogous to the classical result of Milnor and Moore: any differential graded (not necessarily cocommutative) Hopf algebra H that is cofree as a coalgebra carries an underlying \(B_\infty \) algebra structure that restricts to the subspace of primitives, and conversely H may be recovered via a universal enveloping 2-associative differential algebra. This extends the work of Loday and Ronco (J. reine angew. Math. 592: 123–155, 2006) where the ungraded non-differential case was treated, and only the multibrace part of the \(B_\infty \) structure was found. We show that the multibrace algebras of Loday and Ronco (J. reine angew. Math. 592: 123–155, 2006) originate from twistings of quasi-trivial structures, complementing the work of Markl (J. Homotopy Relat. Struct. 10, 637–667 (2015)) on the \(A_\infty \) structure underlying any algebra with a square-zero endomorphism. In this framework we can prove the multibrace and \(A_\infty \) algebras are compatible and provide the appropriate \(B_\infty \) algebra for the structure theorem.