Animals use gustatory information to assess the suitability of potential food sources and make critical decisions on what to consume. For example, the taste of sugar generally signals a potent dietary source of carbohydrates. However, the intensity of the sensory response to a particular sugar, or "sweetness," is not always a faithful reporter of its nutritional value, and recent evidence suggests that animals can sense the caloric content of food independently of taste. Here, we demonstrate that the vinegar fly Drosophila melanogaster uses both taste and calorie sensing to determine feeding choices, and that the relative contribution of each changes over time. Using the capillary feeder assay, we allowed flies to choose between sources of sugars that varied in their ratio of sweetness to caloric value. We found that flies initially consume sugars according to taste. However, over several hours their preference shifts toward the food source with higher caloric content. This behavioral shift occurs more rapidly following food deprivation and is modulated by cAMP and insulin signaling within neurons. Our results are consistent with the existence of a taste-independent calorie sensor in flies, and suggest that calorie-based reward modifies long-term feeding preferences.