Carbon steels are widely used across industries due to low cost, but their service life is severely limited by high corrosion rate. It is possible to inhibit corrosion using protective coatings, which separates the carbon steel from the corrosive medium. But these coatings are usually made from costly and toxic ingredient, such as hexavalent chromium. As a result, it is crucial to develop anti-corrosion coatings that are based on environmentally friendly ingredients. In this study, a multilayer polymeric coating was developed using layer-by-layer (LbL) assembly of polyethylenimine and tannic acid, both of which are non-toxic and reasonably priced. The resultant coating can be produced at different thickness with nanometer-scale precision, and a 60-nm-thick coating was sufficient to keep carbon steel rust-free for at least one month in deionized water. This effective, simple, and versatile strategy could open up new opportunities in developing environment-friendly coatings for carbon steel corrosion prevention.