An act of Congress in 1879 allowed for the government to provide headstones for soldiers buried in private cemeteries. The information about such provisions for the period 1879 to 1903 was recorded on cards and subsequently put on microfilm. The information on those cards is now available online through a volunteer effort.
The information provided includes name, rank, company and regiment, place of burial (including the cemetery’s name and where it is located), date of death. Most of the burials were in private cemeteries, but some were at National Homes for Disabled Soldiers.
Keep in mind the limitations of this database: Union only, private cemeteries (mostly), and death between 1861 and 1902 (approximately).
NOTE: there are a few War of 1812 veterans included in the list.
Check it out at Genealogy Trails - Cards of Union Civil War Headstones