Even though traditionally included in many botany curricula and textbooks, fungi are now thought to be more closely related to animals than to plants and are placed with the animals in the monophyletic group of opisthokonts. Analyses using molecular phylogenetics support a monophyletic origin of the Fungi. The taxonomy of the Fungi is in a state of constant flux, especially due to recent research based on DNA comparisons. These current phylogenetic analyses often overturn classifications based on older and sometimes less discriminative methods based on morphological features and biological species concepts obtained from experimental matings.
 
There is no unique generally accepted system at the higher taxonomic levels and there are frequent name changes at every level, from species upwards. Efforts among researchers are now underway to establish and encourage usage of a unified and more consistent nomenclature. Fungal species can also have multiple scientific names depending on their life cycle and mode (sexual or asexual) of reproduction. Web sites such as Index Fungorum and ITIS list current names of fungal species (with cross-references to older synonyms).
 
The  classification of Kingdom Fungi is the result of a large-scale collaborative research effort involving dozens of mycologists and other scientists working on fungal taxonomy.It recognizes seven phyla, two of which—the Ascomycota and the Basidiomycota—are contained within a branch representing subkingdom Dikarya. The below cladogram depicts the major fungal taxa and their relationship to opisthokont and unikont organisms. The lengths of the branches in this tree are not proportional to evolutionary distances.
 
The major phyla  of fungi have been classified mainly on the basis of characteristics of their sexual reproductive structures. Currently, seven phyla are proposed: Microsporidia, Chytridiomycota, Blastocladiomycota, Neocallimastigomycota, Glomeromycota, Ascomycota, and Basidiomycota
Phylogenetic analysis has demonstrated that the Microsporidia, unicellular parasites of animals and protists, are fairly recent and highly derived endobiotic fungi . One study concludes that the Microsporidia are a sister group to the true fungi, that is, they are each other's closest evolutionary relative. Hibbett and colleagues suggest that this analysis does not clash with their classification of the Fungi, and although the Microsporidia are elevated to phylum status, it is acknowledged that further analysis is required to clarify evolutionary relationships within this group.
 
The Chytridiomycota are commonly known as chytrids. These fungi are distributed worldwide. Chytrids produce zoospores that are capable of active movement through aqueous phases with a single flagellum, leading early taxonomists to classify them as protists. Molecular phylogenies, inferred from rRNA sequences in ribosomes, suggest that the Chytrids are a basal group divergent from the other fungal phyla, consisting of four major clades with suggestive evidence for paraphyly or possibly polyphyly.
 
The Blastocladiomycota were previously considered a taxonomic clade within the Chytridiomycota. Recent molecular data and ultrastructural characteristics, however, place the Blastocladiomycota as a sister clade to the Zygomycota, Glomeromycota, and Dikarya (Ascomycota and Basidiomycota). The blastocladiomycetes are saprotrophs, feeding on decomposing organic matter, and they are parasites of all eukaryotic groups. Unlike their close relatives, the chytrids, which mostly exhibit zygotic meiosis, the blastocladiomycetes undergo sporic meiosis.
 
The Neocallimastigomycota were earlier placed in the phylum Chytridomycota. Members of this small phylum are anaerobic organisms, living in the digestive system of larger herbivorous mammals and possibly in other terrestrial and aquatic environments. They lack mitochondria but contain hydrogenosomes of mitochondrial origin. As the related chrytrids, neocallimastigomycetes form zoospores that are posteriorly uniflagellate or polyflagellate.
 
Members of the Glomeromycota form arbuscular mycorrhizae, a form of symbiosis where fungal hyphae invade plant root cells and both species benefit from the resulting increased supply of nutrients. All known Glomeromycota species reproduce asexually. The symbiotic association between the Glomeromycota and plants is ancient, with evidence dating to 400 million years ago. Formerly part of the Zygomycota (commonly known as 'sugar' and 'pin' molds), the Glomeromycota were elevated to phylum status in 2001 and now replace the older phylum Zygomycota. Fungi that were placed in the Zygomycota are now being reassigned to the Glomeromycota, or the subphyla incertae sedis Mucoromycotina, Kickxellomycotina, the Zoopagomycotina and the Entomophthoromycotina.Some well-known examples of fungi formerly in the Zygomycota include black bread mold (Rhizopus stolonifer), and Pilobolus species, capable of ejecting spores several meters through the air. Medically relevant genera include Mucor, Rhizomucor, and Rhizopus.
 
The Ascomycota, commonly known as sac fungi or ascomycetes, constitute the largest taxonomic group within the Eumycota. These fungi form meiotic spores called ascospores, which are enclosed in a special sac-like structure called an ascus. This phylum includes morels, a few mushrooms and truffles, single-celled yeasts, and many filamentous fungi living as saprotrophs, parasites, and mutualistic symbionts. Prominent and important genera of filamentous ascomycetes include Aspergillus, Penicillium, Fusarium, and Claviceps. Many ascomycete species have only been observed undergoing asexual reproduction, but analysis of molecular data has often been able to identify their closest teleomorphs in the Ascomycota. Because the products of meiosis are retained within the sac-like ascus, ascomycetes have been used for elucidating principles of genetics and heredity .
 
Members of the Basidiomycota, commonly known as the club fungi or basidiomycetes, produce meiospores called basidiospores on club-like stalks called basidia. Most common mushrooms belong to this group, as well as rust and smut fungi, which are major pathogens of grains. Other important basidiomycetes include the maize pathogen Ustilago maydis, human commensal species of the genus Malassezia, and the opportunistic human pathogen, Cryptococcus neoformans.
 
Because of similarities in morphology and lifestyle, the slime molds  and water molds  were formerly classified in the kingdom Fungi. Unlike true fungi the cell walls of these organisms contain cellulose and lack chitin. Slime molds are unikonts like fungi, but are grouped in the Amoebozoa. Water molds are diploid bikonts, grouped in the Chromalveolate kingdom. Neither water molds nor slime molds are closely related to the true fungi, and, therefore, taxonomists no longer group them in the kingdom Fungi. Nonetheless, studies of the oomycetes and myxomycetes are still often included in mycology textbooks and primary research literature.
 
The nucleariids, currently grouped in the Choanozoa, may be a sister group to the eumycete clade, and as such could be included in an expanded fungal kingdom.
Because of similarities in morphology and lifestyle, the slime molds and water molds  were formerly classified in the kingdom Fungi. Unlike true fungi the cell walls of these organisms contain cellulose and lack chitin. Slime molds are unikonts like fungi, but are grouped in the Amoebozoa. Water molds are diploid bikonts, grouped in the Chromalveolate kingdom. Neither water molds nor slime molds are closely related to the true fungi, and, therefore, taxonomists no longer group them in the kingdom Fungi. Nonetheless, studies of the oomycetes and myxomycetes are still often included in mycology textbooks and primary research literature.
 
The nucleariids, currently grouped in the Choanozoa, may be a sister group to the eumycete clade, and as such could be included in an expanded fungal kingdom
The mycorrhizal symbiosis is ancient, dating to at least 400 million years ago. It often increases the plant's uptake of inorganic compounds, such as nitrate and phosphate from soils having low concentrations of these key plant nutrients. The fungal partners may also mediate plant-to-plant transfer of carbohydrates and other nutrients. Such mycorrhizal communities are called "common mycorrhizal networks". A special case of mycorrhiza is myco-heterotrophy, whereby the plant parasitizes the fungus, obtaining all of its nutrients from its fungal symbiont. Some fungal species inhabit the tissues inside roots, stems, and leaves, in which case they are called endophytes.Similar to mycorrhiza, endophytic colonization by fungi may benefit both symbionts; for example, endophytes of grasses impart to their host increased resistance to herbivores and other environmental stresses and receive food and shelter from the plant in return.
The Lichens are formed by a symbiotic relationship between algae or cyanobacteria and fungi , in which individual photobiont cells are embedded in a tissue formed by the fungus. Lichens occur in every ecosystem on all continents, play a key role in soil formation and the initiation of biological succession, and are the dominating life forms in extreme environments, including polar, alpine, and semiarid desert regions. They are able to grow on inhospitable surfaces, including bare soil, rocks, tree bark, wood, shells, barnacles and leaves. As in mycorrhizas, the photobiont provides sugars and other carbohydrates via photosynthesis, while the fungus provides minerals and water. The functions of both symbiotic organisms are so closely intertwined that they function almost as a single organism; in most cases the resulting organism differs greatly from the individual components. Lichenization is a common mode of nutrition; around 20% of fungi—between 17,500 and 20,000 described species—are lichenized. Characteristics common to most lichens include obtaining organic carbon by photosynthesis, slow growth, small size, long life, long-lasting  vegetative reproductive structures, mineral nutrition obtained largely from airborne sources, and greater tolerance of desiccation than most other photosynthetic organisms in the same habitat.
Many insects also engage in mutualistic relationships with fungi. Several groups of ants cultivate fungi in the order Agaricales as their primary food source, while ambrosia beetles cultivate various species of fungi in the bark of trees that they infest.Similarly, females of several wood wasp species  inject their eggs together with spores of the wood-rotting fungus Amylostereum areolatum into the sapwood of pine trees; the growth of the fungus provides ideal nutritional conditions for the development of the wasp larvae. Termites on the African savannah are also known to cultivate fungi, and yeasts of the genera Candida and Lachancea inhabit the gut of a wide range of insects, including neuropterans, beetles, and cockroaches; it is not known whether these fungi benefit their hosts.
Many fungi are parasites on plants, animals (including humans), and other fungi. Serious pathogens of many cultivated plants causing extensive damage and losses to agriculture and forestry include the rice blast fungus Magnaporthe oryzae, tree pathogens such as Ophiostoma ulmi and Ophiostoma novo-ulmi causing Dutch elm disease,and Cryphonectria parasitica responsible for chestnut blight, and plant pathogens in the genera Fusarium, Ustilago, Alternaria, and Cochliobolus. Some carnivorous fungi, like Paecilomyces lilacinus, are predators of nematodes, which they capture using an array of specialized structures such as constricting rings or adhesive nets.
 
Some fungi can cause serious diseases in humans, several of which may be fatal if untreated. These include aspergilloses, candidoses, coccidioidomycosis, cryptococcosis, histoplasmosis, mycetomas, and paracoccidioidomycosis. Furthermore, persons with immuno-deficiencies are particularly susceptible to disease by genera such as Aspergillus, Candida, Cryptoccocus, Histoplasma, and Pneumocystis. Other fungi can attack eyes, nails, hair, and especially skin, the so-called dermatophytic and keratinophilic fungi, and cause local infections such as ringworm and athlete’s foot. Fungal spores are also a cause of allergies, and fungi from different taxonomic groups can evoke allergic reactions
The human use of fungi for food preparation or preservation and other purposes is extensive and has a long history. Mushroom farming and mushroom gathering are large industries in many countries. The study of the historical uses and sociological impact of fungi is known as ethnomycology. Because of the capacity of this group to produce an enormous range of natural products with antimicrobial or other biological activities, many species have long been used or are being developed for industrial production of antibiotics, vitamins, and anti-cancer and cholesterol-lowering drugs. More recently, methods have been developed for genetic engineering of fungi,enabling metabolic engineering of fungal species. For example, genetic modification of yeast species—which are easy to grow at fast rates in large fermentation vessels—has opened up ways of pharmaceutical production that are potentially more efficient than production by the original source organisms
Many species produce metabolites that are major sources of pharmacologically active drugs. Particularly important are the antibiotics, including the penicillins, a structurally related group of β-lactam antibiotics that are synthesized from small peptides. Although naturally occurring penicillins such as penicillin G  have a relatively narrow spectrum of biological activity, a wide range of other penicillins can be produced by chemical modification of the natural penicillins. Modern penicillins are semisynthetic compounds, obtained initially from fermentation cultures, but then structurally altered for specific desirable properties. Other antibiotics produced by fungi include: ciclosporin, commonly used as an immunosuppressant during transplant surgery; and fusidic acid, used to help control infection from methicillin-resistant Staphylococcus aureus bacteria. Widespread use of these antibiotics for the treatment of bacterial diseases, such as tuberculosis, syphilis, leprosy, and many others began in the early 20th century and continues to play a major part in anti-bacterial chemotherapy. In nature, antibiotics of fungal or bacterial origin appear to play a dual role: at high concentrations they act as chemical defense against competition with other microorganisms in species-rich environments, such as the rhizosphere, and at low concentrations as quorum-sensing molecules for intra- or interspecies signaling.
 
Other drugs produced by fungi include griseofulvin isolated from Penicillium griseofulvum, used to treat fungal infections, and statins , used to inhibit cholesterol synthesis. Examples of statins found in fungi include mevastatin from Penicillium citrinum and lovastatin from Aspergillus terreus and the oyster mushroom