© 2020 Institution of Structural EngineersRecently, the interest in research for optimization of viscous dampers in design of buildings has been increasing. In this study, the effect of soil-structure interaction has been taken into account for the purpose of optimal design of viscous dampers. A damper optimization method based on a target damping ratio and interstorey drift ratio found in literature has been adapted for a building structure model considering different types of sandy soils. While passive constraints have been taken as upper and lower limits of each damper, active constraints have been considered as a target damping ratio in terms of damping coefficients. The proposed algorithm includes time history analyses that test the designer's optimal design. Interstorey drift ratios under design earthquakes have been checked at each design step. The first and second mode responses have been considered separately. According to the results obtained from this study, the negative impact of sandy soils on the dynamic behavior of superstructures can be overcome by optimal placement of dampers in buildings. The results of the analyses have shown that soil effects should be taken into account in solving damper optimization problems.