A recursive algorithm to calculate inbreeding coefficients was modified to account for nonzero inbreeding of unknown parents. The modification was done by changing one part of a recursive formula in which the inbreeding of an animal with at least one unknown parent is not zero and replacing it by the mean inbreeding of all animals born the same year. The algorithm is iterative. Testing involved 17 million \US\ Holsteins. Convergence was reached in 6 rounds. The computing time per round was 4 min, twice as fast as the VanRaden algorithm based on the tabular method. The recursive algorithm is very simple; however, it requires that the recursion takes into account the order of animals. After a simple modification, the algorithm provides a very good approximation of inbreeding when the pedigree is unordered.