The invention relates to a traditional Chinese medicine for treating cancers and resisting viruses and a preparation method thereof. A formula of the traditional Chinese medicine for treating cancers and resisting viruses comprises indigowoad leaves, dutchmanspipe root, indigo naturalis, geranium wilfordii, hairyvein agrimony, hedyotis diffusa, fructus perillae, cowherb seeds, mongolian snake gourd root, herba ecliptae, szechwan Chinaberry fruit, longstamen onion bulb, curcuma zedoary, rhizoma sparganic, snakegourd fruit, ampelopsis japonica, frankincense, myrrh, rhizoma phragmitis, angelica root, radix stephaniae tetrandrae, cape jasmine, schizonepeta, ginkgo, sappanwood, Chinese angelica, salviae miltiorrhizae, rhizoma typhonii, cyrtomium fortunei, alum, brucea javanica and venenum bufonis. The traditional Chinese medicine for treating cancers and resisting viruses is applicable to treatment on 'cancers', 'Aids', 'leukemia', 'tumours' and 'liver diseases' caused by known or unknown pathogens and pathogenesis, of men, women, the aged and the young and resistance to various infectious and contagious refractory plague viruses.