No—fossil fuels are not found exclusively in sedimentary rock, but the overwhelming majority of coal, oil, and natural gas that humans produce comes from sedimentary sequences, and the exceptions are narrow, geologically special cases rather than a parallel rule.
That one-sentence answer hides three separate questions that people often blur together: where fossil fuels form, where they accumulate in quantities worth extracting, and where they end up after geological processes have moved them. The short answer above is about the third question—occurrence and production. The second question is where the real constraint lies, and it is the one that makes "only in sedimentary rock" sound true even though it is not strictly correct.
Why sedimentary rock dominates
Fossil fuels are the altered remains of once-living organic matter. For that matter to become coal, oil, or gas, it must be concentrated, buried, and heated in the absence of abundant oxygen. Sedimentary basins provide exactly this combination: they subside over long periods, accumulate organic-rich muds, sands, and peats, and then cook their contents at temperatures that convert kerogen into hydrocarbons.
Two features of sedimentary rock are decisive. First, sedimentary rocks are the main reservoir of concentrated organic carbon at the Earth's surface—shales and coals are literally made partly of it. Second, sedimentary rocks are porous and permeable enough, in the right facies, to store and transmit fluids. Sandstone and carbonate reservoirs hold most of the world's oil and gas because they have connected pore space; shale source rocks hold the organic matter that generated the hydrocarbons.
So the familiar statement "fossil fuels are found in sedimentary rock" is a practical generalization about where economically recoverable deposits sit, not a law of chemistry or physics.
The genuine exceptions
Several non-sedimentary settings do contain fossil fuels or fossil-fuel-like substances.
Coal in volcanic and intrusive settings. Coal is sedimentary in origin—it forms from accumulated plant material in swampy basins. But coal seams can be intruded by igneous rock, and heat from magma can alter the coal into natural coke or anthracite. The coal itself remains a sedimentary deposit; the igneous rock is an intruder, not a host. This is a common source of confusion: a mine may cut through basalt or granite, but the coal seam is still sedimentary.
Hydrocarbons in igneous and metamorphic rocks. Oil and gas can occur in fractured igneous rock (for example, fractured basalt or granite) and in metamorphic rock, but in most cases the hydrocarbons migrated there from adjacent sedimentary source rocks. The host rock is non-sedimentary; the fuel is not native to it. Basement reservoirs—fractured granite or metasediments beneath sedimentary cover—are documented in several petroleum provinces. The fuel is still generated in sedimentary source rock and trapped in the basement.
Abiogenic hydrocarbons. Small amounts of methane and other hydrocarbons can form without biological material, for example in some mantle-derived fluids and in certain igneous and metamorphic environments. These are scientifically real but commercially negligible. They do not support the idea of large exploitable abiogenic oil fields; the consensus is that commercial accumulations are overwhelmingly biogenic and sedimentary-sourced.
Peat. Peat is an organic sediment, not yet coal. It is technically a fossil fuel precursor and is sedimentary in character—an unconsolidated deposit of partially decayed plant matter. It is best treated as an early stage of the coal series rather than an exception.
Methane hydrates and shale gas. These are sedimentary-hosted: hydrates in marine sediments, shale gas in organic-rich mudstones. They reinforce, rather than challenge, the sedimentary pattern.
The key distinction: source rock versus reservoir rock versus host rock
The confusion usually comes from collapsing three different roles into one word, "found."
Source rock is where hydrocarbons are generated. It is almost always organic-rich sedimentary rock (shale, marl, limestone). Reservoir rock is where hydrocarbons accumulate in pore space. It is usually sedimentary (sandstone, carbonate), occasionally fractured crystalline rock. Host rock is simply whatever rock the fuel is physically in. This can be igneous or metamorphic if migration has occurred.
A useful parallel: a person born in one country can live in another. The birthplace is the source; the residence is the reservoir. Saying "oil is found only in sedimentary rock" confuses birthplace with residence and ignores migration entirely.
What "found" means in different contexts
In a classroom, "fossil fuels are found in sedimentary rock" is a reasonable first approximation because it describes where the vast majority of reserves occur and why. In a petroleum geology context, the statement is too strong: basement reservoirs, fractured igneous plays, and migrated hydrocarbons in crystalline rock are real, if uncommon.
The distinction matters for exploration. A explorer who assumes fuels exist only in sedimentary basins will miss fractured-basement plays; one who assumes they exist anywhere will waste money drilling crystalline rock with no source or migration pathway nearby. The practical rule is: sedimentary source rock plus a migration route plus a trap, which usually but not always means a sedimentary reservoir.
Language note
The word "found" carries ambiguity. "Found" can mean "discovered in nature" (occurrence) or "located in commercial quantities" (production). The two are not the same. Trace hydrocarbons occur in many rock types; economic accumulations are concentrated in sedimentary basins. The question is best answered by separating occurrence from recoverability.
Bottom line
Fossil fuels are not restricted to sedimentary rock, but the exceptions are minor, mostly migration-related, and not the basis of the modern energy system. The accurate statement is: fossil fuels form predominantly in sedimentary rocks and are produced overwhelmingly from sedimentary reservoirs, with occasional occurrences in fractured igneous and metamorphic rocks where hydrocarbons have migrated from sedimentary source rocks.