Oh, the hellish question! Dare you use profanity in your writing?
1) It depends on your target audience.
Will they be offended? Do you care? The more explicit terms should be left out of cozy mysteries.
2) Does it fit the context of the plot?
If you are writing about nuns in England in 1300, I doubt they used the F-bomb. You might have a salty old nun who muttered the occasional "bloody hell" but only after the reign of Bloody Mary I (queen regent from 1553 to 1558).
I wrote a series set in 3500 BC. Trying to write without some form of expletive, insult, or curse word was painful. I had to resort to them calling each other names of animals etc. Some form of exclamation is needed, but not every other paragraph. I had to stringently edit it.
3) Is it appropriate for your target audience?
If you write children's picture books or Christian romance, I'd leave it out.
4) Are you using it to define character?
Some characters swear like sailors. Others never would. Do your space aliens have potty mouths? Are your characters living in the ghettos of New York City? If so, drop the F-bomb a few times. Don't use it for shock value. The F-bomb has lost its impact by overuse. It isn't shocking anymore. The F-word is versatile. It is a noun, adjective, and verb, even though it stands for "For Unlawful Carnal Knowledge" and did not exist prior to England adopting the acronym in roughly the 1400s. Modern television and film scripts overuse it and it becomes redundant.
5) Are you using it effectively?
A rare profanity inserted for effect is better than twenty in a row. Profanity offends many. They are red words and imply anger, even if the person isn't angry. It may limit your audience. It's important to ask how your agent or editor feels about it. If she hates it, she might insist you take it out. If you stand your ground, you may have to find another agent or editor, or publish it yourself.
If profanity is inserted into every sentence, it feels abusive. No one likes listening to abusive people rant, even in fiction.
6) Can you make up new ones?
This is a serious challenge for fantasy and science fiction writers. Come up with a few, carefully selective, highly descriptive swear words for your characters. We'll love you for it. It may even get included in the English lexicon. For historical fiction writers, make sure the word was used in the era you describe. Make sure the word is something your character would have come into contact with. If you don't do this well, it is a speed bump.
For a list of other editing and revision tips, pick up a copy of: