The Sun has appeared as a setting in fiction at least since classical antiquity, but for a long time it received relatively sporadic attention. Many of the early depictions viewed it as an essentially Earth-like and thus potentially habitable body—a once-common belief about celestial objects in general known as the plurality of worlds—and depicted various kinds of solar inhabitants. As more became known about the Sun through advances in astronomy, in particular its temperature, solar inhabitants fell out of favour save for the occasional more exotic alien lifeforms. Instead, many stories focused on the eventual death of the Sun and the havoc it would wreak upon life on Earth. Before it was understood that the Sun is powered by nuclear fusion, the prevailing assumption among writers was that combustion was the source of its heat and light, and it was expected to run out of fuel relatively soon. Even after the true source of the Sun's energy was determined in the 1920s, the dimming or extinction of the Sun remained a recurring theme in disaster stories, with occasional attempts at averting disaster by reigniting the Sun. Another common way for the Sun to cause destruction is by exploding ("going nova"), and other mechanisms such as solar flares also appear on occasion.

Besides being a source of destruction, the Sun has been used in fiction as a source of power—both in the form of solar power and superpowers. The solar wind is also used for propulsion by spacecraft equipped with solar sails. Solar eclipses have appeared in a large number of stories, in the earliest ones often used as a ruse by characters who know that they can be predicted mathematically against those who do not by pretending to cause them, perhaps inspired by the story of Christopher Columbus doing the same with a lunar eclipse in 1504. When audiences grew weary of this trope by the 1930s or 1940s, eclipses became much more rare in fiction writing, though they saw a comeback towards the end of the century as harbingers of social upheaval. Sunspots, and their 11-year cycle of frequency in occurrence, appear in a small number of works. The Sun poses a danger to spacecraft that approach it closely, a situation that occurs by necessity or design in several stories. It is sometimes depicted as being sentient, though this is rare compared to other stars getting the same treatment. Overall, the Sun remains relatively uncommon as a point of focus in science fiction, particularly in comparison to depictions of Mars and Venus; says science fiction bibliographer Richard Bleiler, "Perhaps because it is generally taken for granted, the fictive potential of the Sun has barely been tapped".

Early depictions: inhabited

The Sun received comparatively little specific attention in early science fiction; prior to the late 1800s, when Mars became the most popular celestial object in fiction, the Sun was a distant second to the Moon. A large proportion of the works that nevertheless did focus on the Sun portrayed it as having inhabitants. In Lucian of Samosata's work A True Story from the second century CE, described by science fiction scholar Gary Westfahl as the first depiction of space travel in fiction, the inhabitants of the Sun are at war with those of the Moon. Later stories with an inhabited Sun include Athanasius Kircher's 1656 work Itinerarium exstaticum, where life in the usual sense does not exist on the Sun but angelic beings do, and Cyrano de Bergerac's posthumously published 1662 novel . In the 1700s, solar inhabitants were depicted by French authors , whose 1750 novel Relation du Monde de Mercure describes them ruling over the inhabitants of Mercury, and Marie-Anne de Roumier-Robert, whose 1765 novel Voyage de Milord Céton dans les sept planètes portrays a society on the Sun characterized by equality of the sexes.

The concept of the plurality of worlds—the notion that other heavenly bodies should be essentially Earth-like and therefore habitable—endured in fiction with regard to the Sun well into the 1800s. These works include George Fowler's 1813 novel A Flight to the Moon; or, The Vision of Randalthus, the anonymously published 1837 novel Journeys into the Moon, Several Planets and the Sun, and Joel R. Peabody's 1838 novel A World of Wonders. Even in the early 1900s, when the temperature of the surface of the Sun had been determined by spectroscopic measurement, the portrayal of the Sun as inhabited persisted in some works of juvenile fiction such as 's 1909 novel Through the Sun in an Airship and 's 1910 novel By Aeroplane to the Sun.

In the 1900s, as it became evident that no conventional organisms could possibly survive the conditions on the Sun, more exotic solar lifeforms started appearing in fiction. Some of these live inside the Sun itself rather than on its surface, as in short stories like Jack Williamson's 1935 "Islands of the Sun", Raymond Z. Gallun's 1935 "Nova Solis", and Henry J. Kostkos's 1936 "We of the Sun". Others take up residence elsewhere in the Solar System: in Leigh Brackett's 1942 short story "Child of the Sun", an intelligent alien from the Sun lives in the hollow interior of the fictional planet Vulcan inside the orbit of Mercury, and the titular creatures of Olaf Stapledon's 1947 novel The Flames are lizard-like solar beings residing inside igneous rocks on Earth. Arthur C. Clarke's 1958 short story "Out of the Sun" features life "formed of tangles of magnetic flux on the surface of our Sun", and Edmond Hamilton's 1962 short story "Sunfire!" depicts an energy-based lifeform living in the Sun's corona.

Disaster

The Sun has been a source of destruction or the threat thereof in many stories, most commonly either by fading or exploding. In the rare science fiction films where the Sun is a central point of focus, it seldom plays any other role.

Dimming and extinction

The dimming or extinction of the Sun has been a recurring theme. The earliest such stories were inspired by the assumption that the heat and light of the Sun were products of combustion, and that the fuel sustaining it would eventually run out. Physicist Lord Kelvin estimated in 1862—based on a model where the heat was the result of gravitational contraction—that the Sun would fade within a few million years, a timeframe that was later incorporated in stories by Camille Flammarion and H. G. Wells, among others. In Flammarion's 1894 novel Omega: The Last Days of the World, humanity survives an encounter with a comet but succumbs to the dimming of the Sun thousands of years later, while the time traveller in Wells's 1895 novel The Time Machine discovers a cooled and reddened Sun over a barren Earth in the far future. Similarly, stories about the end of the world involving the death of the Sun were written in the early 1900s by among others George C. Wallis, whose 1901 short story "The Last Days of Earth" depicts the last survivors leaving a frozen Earth for a potentially habitable planet in another planetary system, and William Hope Hodgson, whose 1908 novel The House on the Borderland describes one character's vision of the destruction of both the Earth and Sun.

By the 1920s, the gravitational contraction hypothesis had fallen out of favour. The new explanation was that the Sun was fuelled by nuclear fusion, an understanding that was pioneered by the work of astrophysicist Arthur Eddington. As a result, science fiction authors started incorporating much longer solar lifespans in their stories, with J. B. S. Haldane's 1927 work "The Last Judgment" and Olaf Stapledon's 1930 novel Last and First Men both outlining the future evolution of humanity throughout millions of years of variation in solar luminosity. Stories depicting the Sun waning nevertheless kept appearing, such as Clark Ashton Smith's stories about the fictional future continent Zothique starting with the 1932 short story "The Empire of the Necromancers", and Jack Vance's Dying Earth series starting with the 1950 anthology The Dying Earth which also gave its name to the dying Earth subgenre of science fiction. Nat Schachner's 1934 short story "When the Sun Dies" describes the entire Earth freezing over in the 1980s as a result of a reduction in solar activity, and in Arthur C. Clarke's 1949 short story "History Lesson", future Venusians find humanity extinct due to the environmental changes brought about by the Sun fading. Clarke also touched upon the subject in the 1938 poem "The Twilight of the Sun" and the 1979 novel The Fountains of Paradise. In a variation on the theme, Fritz Leiber's 1951 short story "A Pail of Air" depicts Earth having been pulled away from the gravitational influence of the Sun and thus turned into a rogue planet, with a climate so cold that air has frozen and needs to be collected and thawed to turn it gaseous and breathable. Edmond Hamilton's 1934 short story "Thundering Worlds" sees all the planets leaving the Solar System to find a new star as the Sun dies, while his 1963 comic book story "Superman Under the Red Sun" depicts Superman travelling into the far future and losing his superpowers as a result of the aging red Sun. Eric C. Williams's 1965 short story "Sunout" depicts scientists reacting to the realization that the Sun is about to go out and they are powerless to do anything about it. In the 2019 film The Wandering Earth, the death of the Sun prompts humanity to relocate the entire Earth to a new planetary system.

A handful of stories describe efforts to reignite the fading Sun. In Clark Ashton Smith's 1954 short story "Phoenix" (written ), this is accomplished by detonating several nuclear weapons on the Sun's surface. In Gene Wolfe's 1980–1983 four-volume novel The Book of the New Sun and its sequels, a white hole is used to reinvigorate the dying Sun. The concept of using an explosive device for this purpose is also explored in the 2007 film Sunshine.

Exploding