A fast algorithm is described which calculates the space charge layer width and junction capacitance for an arbitrary impurity profile and for plane, cylindrical and spherical junctions. The algorithm is based on the abrupt space charge edge (ASCE) approximation. A method to use the algorithm for the determination of impurity profiles for two-sided junctions is presented. An expression is derived for the built-in voltage to be used for capacitance calculations with the ASCE approximation. Experimental evidence is given that the algorithm permits very accurate capacitance calculations and also predicts the exact temperature dependence of the junction capacitance.