Each grain, extract or sugar has a certain amount of potential sugar which can be extracted through the mashing process. You can see this amount in the grains/sugars listing under max PPG (points per gallon). This calculation sums the possible sugars which could be extracted and based on the size of the batch it estimates the original gravity.
Beer Gravity Calculator
The grains, extracts and fermentable sugars you use contribute sugars to the wort. These sugars are converted to alcohol by the yeast during fermentation. You can use this calculator to estimate the intial gravity, final gravity and the alcohol by volume of your beer.