Fountain code is a class of graph-based linear erasure codes, which can effectively solve the problems such as network congestion and feedback cracking for its characteristics of rateless and can resume when interrupted, and has a lower complexity of encoding and decoding. However, there are still some problems in the process of encoding and decoding, including the degree distribution structure may be destroyed, parameters of the generating matrix are not fixed, and it cannot recover source datas from the remaining encoded packets with no degree one. So, the basic theory of fountain codes from three aspects are introduced in this paper, i.e., degree distribution, encoding and decoding principles. Therefore the improved algorithms according to the above three aspects are presented. Simulation results show that the proposed algorithm is more efficient than the previous one.