Combine the sugar, water, and pistachios in a small pan.
Bring to a boil, stirring until the sugar is dissolved, then lower the heat to a simmer.
Simmer for 8-10 minutes. Add the optional almond extract in the last 2-3 minutes of simmering to remove the boozy taste.
Remove from heat. Let the syrup rest for 15 minutes to infuse the flavor.
Strain through cheesecloth and a fine mesh strainer. Store in the refrigerator for up to 2 weeks.
