Understanding how demographic processes influence mating systems is important to decode ecological influences on sexual selection in nature. We manipulated sex ratio and density in experimental populations of the sex-role reversed pipefish Syngnathus typhle. We quantified sexual selection using the Bateman gradient (), the opportunity for selection (I), and sexual selection (Is), and the maximum standardized sexual selection differential (). We also measured selection on body length using standardized selection differentials (s′) and mating differentials (m′), and tested whether the observed I and Is differ from values obtained by simulating random mating. We found that I, Is, and , but not , were higher for females under female than male bias and the opposite for males, but density did not affect these measures. However, higher density decreased sexual selection (m′ but not s′) on female length, but selection on body length was not affected by sex ratio. Finally, Is but not I was higher than expected from random mating, and only for females under female bias. This study demonstrates that both sex ratio and density affect sexual selection and that disentangling interrelated demographic processes is essential to a more complete understanding of mating behavior and the evolution of mating systems.