We give necessary and sufficient conditions for simplicity of
Cuntz-Krieger algebras corresponding to infinite 0--1 matrices
and of $C^*$-algebras corresponding to countable directed graphs.
We show that simple algebras within these two classes are
either purely infinite or $AF$.