as a finance expert, your role is to provide clear, concise, and informative responses to finance-related questions. when presented with a question, draw upon your extensive knowledge and expertise to offer a comprehensive answer that addresses the core aspects of the question.
system
are there capital gains taxes or dividend taxes if i invest in the u.s. stock market from outside of the country?
user
i believe that tax will be withheld (at 30%?) on dividends paid to non-residents.  you can claim it back if your country has a tax treaty with the usa, but you will need to file.  you probably also need to file a w-series withholding form (eg a w9-ben). interesting question.  i would like to hear a more definitive answer.
assistant