Sonic the Hedgehog is a 2D side-scrolling platformer. The gameplay centers around Sonic's ability to run at high speed through levels that include springs, slopes, bottomless pits, and vertical loops. The levels are populated with hazards in the form of robots inside which Dr. Robotnik has trapped animals. Destroying a robot frees the creature, but is not necessary to complete the game. The player must also avoid touching spikes, falling into bottomless pits, and being crushed by moving walls or platforms, as well as drowning, which may be prevented by breathing air bubbles from vents. Sonic's main means of attack is the Spin Attack, in which he curls into a ball and rotates, damaging enemies and certain obstacles upon collision. This may be performed by jumping or by rolling on the ground.
At the start of the game, the player is given three lives, each of which may be lost if Sonic collides with hazardous enemies or objects while in possession of no rings, falls to the bottom of the level screen, or exceeds an act's ten-minute time limit. Signposts that act as checkpoints allow Sonic to return to the most recently activated post when he loses a life. If Sonic loses a life as a result of time running out but has another, the time will reset when he returns to the checkpoint. If all lives are lost, the "Game Over" screen will appear, at which point the player may return to the beginning of the act with three lives if the player has any continues.
Scattered around each level are gold rings. Collecting 100 rings rewards the player with an extra life. Rings act as a layer of protection against hazards: if Sonic holds at least one ring when he collides with an enemy or dangerous obstacle, he will survive. However, all rings in his possession will be scattered; they flicker and disappear in a few seconds if not picked up again. If he is hit without holding any rings, he loses a life. Shields and temporary invincibility can be collected to provide additional layers of protection, but certain hazards, such as drowning, being crushed, falling down a bottomless pit or running out of time, will cause Sonic to lose a life regardless of rings or other protection.
The main body of the game is split into six principal zones, followed by a short 'Final Zone'. Each main zone has its own visual style, and while some enemies appear throughout the game, each zone has enemies and obstacles unique to it alone. Each main zone is split into three acts, all of which must be completed by the player. At the end of each main zone's third act, the player confronts Dr. Robotnik for a boss fight. For most of the fights, Robotnik's vehicle is fitted with different weapons. After completing the sixth zone, the player continues directly to the single-level "Final Zone" for a last encounter with Robotnik inside a large machine environment. Destroying Robotnik's machine ends the game. A brief animation shows Sonic's return to the game's first zone, with animals liberated from Robotnik.
When Sonic reaches the end of Act 1 or Act 2 of a zone while holding at least 50 rings, a large ring appears through which he can jump to enter a "Special Stage." In the Special Stages, Sonic is continually curled up in his Spin Attack animation, and bounces off the bumpers and walls of a fully rotating maze. In these levels, the player earns a continue with each 50 rings collected, but the main goal is to obtain the Chaos Emerald hidden within the maze. Colliding with any of the blocks marked "GOAL" will instantly end the level.
In an attempt to steal the six Chaos Emeralds and harness their power, the game's antagonist, Dr. Ivo Robotnik,[d] has trapped the animal inhabitants of South Island in aggressive robots and stationary metal capsules. The player controls Sonic, who aims to halt Robotnik's plans by freeing his animal friends and collecting the emeralds himself. If the player collects all the Chaos Emeralds and completes the game, an ending sequence is shown. If all the emeralds are not collected, Robotnik taunts the player while juggling any of the Chaos Emeralds not collected by the player.