A modular rail system for an upper receiver of a firearm is provided, the modular rail system having: a bottom portion configured to be removably secured to the upper receiver, wherein the bottom portion has an integrally formed bottom rail and a forward portion located forward of a top rail of the upper receiver; an upper rail extension configured to be removably secured to the forward portion of the bottom portion; and a release mechanism for releasably securing the upper portion to the forward portion of the bottom portion.