As a literary genre, Science Fiction (a subset of Speculative Fiction) is broad and incorporates subgenres ranging from Steampunk to Cyberpunk, running headalong through Space Opera on the way.
Science Fiction depends on asking "what if?" (Not quite the same thing as What If?). Or as an obscure 1930s Science Fiction musical asked, "just imagine"...
- ...travel between stars were possible.
- ...aliens came to Earth.
- ...a utopia or a dystopia.
- ...the future.
- ...we had superhuman abilities.
- ...a war had favored the other side.
- ...you could visit a world where you were never born.
The one defining(-ish, definitions differ) trait of Science Fiction is that there is technology that doesn't exist in the time period the story is written in. Consider 20,000 Leagues Under the Sea. The story was written in a time when submarines were still at the prototype stage, so 20,000 Leagues Under the Sea falls within the boundaries of Science Fiction.
However, Science Fiction is as much a genre as a setting. Often, the technology is a means to explore a concept, and the story could be a detective story focusing on how advanced technology affects crime and policing. This story would be both Science Fiction and Detective Story.
In general, without getting too much into the advanced and diverse subgenres of science fiction, there are two schools — "hard" and "soft". While the distinction isn't always clear cut, there are a few key differences. Hard science fiction relies on using already established science or justifying its fictionalized science using carefully calculated predictions. Hard SF tries to use the advanced technology as something that is important in itself, with its consequences, limitations and new uses being the main plot points. Due to the heavy focus on the scientific aspect, this is a rather niche market. Soft science fiction includes everything else, and generally falls under two major schools — adventure/pulp science fiction (which includes the Space Opera) and social science fiction. The former uses technology as a means to an end, merely a backdrop that allows The Captain to fight for Justice™ with a Stun Ray against the evil aliens and have space sex with the Green-Skinned Space Babe, instead of having to have him use a boring, ordinary gun and have boring, ordinary sex, with the boring, ordinary-skinned Earth babe. In the latter, the technology is used as a means of exploring characters and its social/psychological effects. Of course, it is entirely possible to have an action packed adventure story with deep social commentary.
In both schools of soft science fiction, it usually doesn't matter whether the technology used is actually plausible or not, and there is often little to no explanation as to how the technology would actually work. Otherwise, it may rely on such devices as Techno Babble to maintain a "sci-fi" atmosphere without the author actually having to use detailed scientific principles. Because hard science fiction tends to focus more on scientific detail and soft science fiction focuses on well developed characters and/or adventure, there is a divide between certain sections of the fandom. This divide has been around since, essentially, the very beginning of the genre. However, "hard" and "soft" say nothing about quality or literary value, just the level of scientific detail and accuracy used.
As with everything, there is often a blend of Hard and Soft science fiction. It is perfectly possible to write a hard Science Fiction story about The Captain running around shooting people with miniaturized microwave emitters designed to incapacitate people without killing them, shooting aliens and having sex with Green Skinned Space Babes (with no chance of conception because green aliens are biologically incompatible with humans), just as one can go into considerable detail justifying otherwise implausible technology that is much like magic (usually accomplished by deliberately altering basic scientific laws) and its effects on scientific research. This can often lead to Hidden Depths.
Science Fiction authors and fans are notoriously cranky about how their work is not taken seriously by the literary community, and especially resent being lumped in with the fantasy genre. (Speculative Fiction, an umbrella term for all varieties of imaginative literature, has an analysis page that explains the differences between Fantasy and Science Fiction.) Note also that many Science Fiction fans dislike the term "SciFi": to them it suggests the flanderized conception of the genre in popular culture, with green-skinned aliens, giant space battles and hammy production values. Therefore, they will insist on calling it SF for short.
See also: Speculative Fiction Tropes, Speculative Fiction Series, Speculative Fiction Creator Index, Technology Marches On. Not to be confused with Fiction Science, which is when we use Real Life science to examine fictional works.
Subgenres:
(Exact definitions of these genres, including whether they're really Sci-Fi, and how much they overlap with Fantasy, will vary from person to person.)
- Hard and Soft Science Fiction
- Mundane Science Fiction (a hard SF subgenre)
- Alien Works
- Apocalyptic and Post-Apocalyptic Fiction
- Alternate Techline
- Kaiju Works
- Mecha Show
- Military Science Fiction
- Mutant Media
- New Wave Science Fiction
- New Weird
- Pastoral Science Fiction
- Planetary Romance
- Punk Punk
- Robot and A.I. Works
- Sci-Fi Horror
- Science Fantasy
- Space Opera
- Space Western
- Speculative Biology
- Speculative Documentary
- Tesla Tech Timeline
- Time Travel
- Video Game Stories
- Zombie Stories