Residual sugar (or RS) is the measure of the amount of sugar solids that remain unfermented in a finished wine. Plus any sugar added when making a sweet wine, or the 'dosage' added to a sparkling wine. Residual sugar concentration is expressed in grams per litre (g/L) or as a percentage of weight to volume. For example: a wine with 0.2% residual sugar contains two grams of sugar in a litre of wine.
Residual sugar is usually measured in grams of sugar per litre of wine. Even among the driest wines it is rare to find wines with a level of less than 1 g/L, due to the unfermentability of certain types of sugars, such as pentose. Example: Brookfields 'Marshall Bank' Chardonnay 2015 has approximately 1.2 g/L - (and described as Dry).

 

By contrast, any wine with over 45 g/L would be considered sweet, though many of the great sweet wines have levels much higher than this. For example, the great vintages of Château d'Yquem contain between 100 and 150 g/L of residual sugar. De Bortoli 'Noble One' Botrytis Semillon can have anywhere from 150 - 210 g/L of residual sugar. Paul Jaboulet's 'Muscat Beaumes de Venice' 2007 has 252 g/L of residual sugar. The sweetest form of the Hungarian Tokaji wine can contains over 450 g/L, with exceptional vintages registering 900 g/L.

Such wines only avoid the cloying taste associated with such elevated levels of sugar - by carefully utilising the naturally developed fruit acidity. This means that the finest sweet wines are made with grape varietals that keep their acidity even at very high ripeness levels, such as Riesling, Chenin Blanc, Semillon and Sauvignon Blanc.
Residual sugar typically refers to the sugar remaining after fermentation has stopped (naturally or controlled), but it can also result from the addition of unfermented 'must' (a technique practiced in Germany and known as Süssreserve) or ordinary table sugar. The latter technique is generally used on low quality, often non-grape wines, and in most winemaking regions is banned completely. So regardless of a wine tasting sweet or dry, just about every wine contains a small amount of unfermented or residual sugar.