The chi-square test asks whether observed counts differ from what you would expect by chance. Enter a contingency table to test whether two categorical variables are independent, or supply expected frequencies for a goodness-of-fit test. Expected counts are calculated for you and the assumptions are checked.
For a contingency table it is (rows - 1) x (columns - 1), so a 2x2 table has 1 degree of freedom. For a goodness-of-fit test it is the number of categories minus 1, minus one more for each parameter you estimated from the data.
The chi-square approximation becomes unreliable. The usual rule is that all expected counts should be at least 1 and no more than 20% should be below 5. If yours fail that, use Fisher's exact test instead. The calculator warns you when this happens.