We perform comprehensive density functional theory calculations of strain effect on electronic structure of black phosphorus (BP) and on BP nanoribbons. Both uniaxial and biaxial strain are applied, and the dramatic change of BP’s band structure is observed. Under 0–8% uniaxial strain, the band gap can be modulated in the range of 0.55–1.06 eV, and a direct–indirect band gap transition causes strain over 4% in the y direction. Under 0–8% biaxial strain, the band gap can be modulated in the range of 0.35–1.09 eV, and the band gap maintains directly. Applying strain to BP nanoribbon, the band gap value reduces or enlarges markedly either zigzag nanoribbon or armchair nanoribbon. Analyzing the orbital composition and using a tight-binding model we ascribe this band gap behavior to the competition between effects of different bond lengths on band gap. These results would enhance our understanding on strain effects on properties of BP and phosphorene nanoribbon.