If it's above my social security, I must put "F." That's what you'll get if you look up my number. I wouldn't want to be nailed for fraud.
If it's something less important than a legal document, than I'll select "M." If there is a "decline to state" answer, that I will select that one. Mostly because to most people 'gender' means 'sex.'
Hopefully I will be able to change that legal "F" to an "M" and end all the confusion. I am very fortunate that in this country the "M" doesn't come at the cost of phalloplasty.