The notion of commutative integro-differential algebra was introduced for the algebraic study of boundary problems for linear ordinary differential equations. Its noncommutative analog achieves a similar purpose for linear systems of such equations. In both cases, free objects are crucial for analyzing the underlying algebraic structures, e.g. of the (matrix) functions.In this paper we apply the method of Gröbner–Shirshov bases to construct the free (noncommutative) integro-differential algebra on a set. The construction is from the free Rota–Baxter algebra on the free differential algebra on the set modulo the differential Rota–Baxter ideal generated by the noncommutative integration by parts formula. In order to obtain a canonical basis for this quotient, we first reduce to the case when the set is finite. Then in order to obtain the monomial order needed for the Composition-Diamond lemma, we consider the free Rota–Baxter algebra on the truncated free differential algebra. A Composition-Diamond lemma is proved in this context, and a Gröbner–Shirshov basis is found for the corresponding differential Rota–Baxter ideal.