According to Chinese Pharmacopoeia, Escherichia coli should not be detected in oral drugs. In this study, a visual LAMP method for rapid detection of Escherichia coli was developed to replace the traditional microbial limit test method. Methods Four specific primers (FIP, BiP, F3, B3) for loop mediated isothermal amplification were designed by using uidA gene of Escherichia coli, and calcein-Mn2+ dye was added to the system to establish a visual loop mediated isothermal amplification detection method for Escherichia coli Finally, the visual LAMP system was used to detect the presence of E.coli and the sensitivity of the system in drugs. Results The specificity of the optimized system was good, using this system to detect 10 different strains, the results showed that only Escherichia coli genome appeared, the system turned green, the other systems were brown yellow; the detection limit of gradient dilution Escherichia coli was 102 CFU/mL by LAMP. Visual LAMP was used to detect the oral drugs sold in the market and not passed the test of the drug administration, and no E.coli was detected, but the oral drugs that were artificially contaminated with E.coli were visualized by LAMP. The color detection limit of the system in oral drugs was 1.8×102 CFU/mL. Conclusion The visual LAMP detection system can be used for the preliminary detection of oral drugs containing Escherichia coli.