A nonlinear substitution operation of bytes is the main strength factor of the Advanced Encryption Standard (AES) and other modern cipher systems. In this paper we have presented a new simple algorithm to generate key-dependent S-boxes and inverse S-boxes for block cipher systems. The quality of this algorithm was tested by using NIST tests, and changing only one bit of the secret key to generate new key-dependent S-boxes. The fact that the S-boxes are key-dependent and unknown is the main strength of the algorithm, since the linear and differential cryptanalysis require known S-boxes. In the second section of the paper, we analyze S-boxes. In the third section we describe the key-dependent S-boxes and inverse S-boxes generation algorithm. Afterwards, we experimentally investigate the quality of the generated key-dependent S-boxes. Comparison results suggest that the key-dependent S-boxes have good performance and can be applied to AES.