Cody is located at the western edge of the Bighorn Basin, a depression surrounded by the Big Horn, Owl Creek, Bridger, and Absaroka ranges. At the western edge of Cody, a deep canyon formed by the Shoshone River provides the only passage to Yellowstone's Eastern Entrance. At its mouth and rising above Cody are Rattlesnake Mountain on the north side and Cedar Mountain on the south side. Much of Cody has views of Heart Mountain, whose peak is directly north of Cody, and the Carter Mountain massif, which forms a line with peaks above , some to the south.