When asking a question on stackoverflow, one is suggested to answer one's own question with the following text:

Answer your own question – share your knowledge, Q&A-style

And yet it seems rather unpopular to me, that is, types of questions that seem of good quality (perhaps I'm biased because I'm thinking about my own questions) don't get as much immediate attention. For example:

How do I create small files with Bash?

So my question here, is does this sort of answering your own question right off with your question work and is it really encouraged on stackoverflow?

  • 7
    It may get less votes in the short term(people looking at new questions sometimes skip "answered" ones), but in the long term it will be fine. That is, if it's truly a useful and good question/answer. People finding it later don't care that you answered it yourself, they just care that it fixed their problem or taught them something.
    – Geobits
    Dec 19, 2013 at 14:13

4 Answers 4


Of course it is encouraged in all situations.

If you find about a topic that might helps others here and you realize that no posts about it exists here, might as well ask and answer it yourself. Same if you found the answer you were looking for before getting the answer you needed, you should let everyone know by putting the answer you found there.

The problem with this is you must make sure of two things :

  • Will it help others ?
  • Is it already asked

Question you ask

Guys what is going on with this part of code

int x = 5;
int y = 6
int z = x + y;

Answer you give

You must have a semi-colon at the end of the instruction

This is bad and an example of a question / answer that was specific to your case and unlikely to help people.

Users won't Google : Why won't my second line of code compile in this situation.
But they might search for : Why do we need a semi-colon to mark the end of an instruction

Anyways I'm getting a little out of the topic right now.


Yes you were right to answer your own question in that case.


It's not that it's discouraged at all, it's more that it's just really hard to do well. When answering their own questions many people have a hard time choosing topics that others will find interesting that also has information not easily accessible already.

Questions in particular are very hard to write when you intend to answer the question yourself. Having a very high quality question, when self answering, is very important, but many people put little or no time into them, making a question that appears just lazy, too broad, unclear (because the author already knows how to answer it; they don't see the need to explain enough details in the question for someone else to answer it), etc.

Finding really high quality self-answered questions tends to be rare, which is why finding self answered questions that get a very good reception from the community is rare.


Of course it's encouraged. I mean, it gives you the option directly on the "Ask a Question" page.

If you've done the research and the question hasn't already been asked and/or answered, and you've taken the time to figure out the solution to a problem you've been having, post it and answer it. Share that knowledge. That's what this community is for. Don't worry about the intimidate attraction. Later down the road someone is going to find that question and thank you!

Here's what SO says about answering your own question.

I also found this blog post that specifically says:

"...it is not merely OK to ask and answer your own question, it is explicitly encouraged."


Usually when I self answer a question, it's because I realized what the answer was in writing the question, or I found an answer some time after writing it. I don't recommend asking questions just to answer them very often on SO, but it can work on some sites. Most of the time I find myself asking a question I knew beforehand what the answer is is if I'm a real expert in the field and I want to guide newer people to learn something new, or if it's a new site that I've been participating in Area 51, and have been thinking about good questions for quite a while.

Not the answer you're looking for? Browse other questions tagged .