How to ask a good Stackoverflow question

Written by on June 3, 2014

How to ask a good Stackoverflow question

If you are reading this article, you are probably here because someone told you to read this article. Don’t look at this as a bad thing, this article is here to help you, while also, at the same time, helping StackOverflow community. Let me guess one more thing, you already asked at least one question, it was downvoted and closed before you even got needed answer? If this is true, keep reading this article, I will try to help you learn how to ask a Stackoverflow question properly without been affected by “close-warriors”.

Before you ask who are “close-warrior” let me give you a short explanation. They are SO users aimed at removal of content deemed wrong to the person posting the question rather than the creation of useful content or the improvement of naturally arising low-quality content. This is the trend that was brewing last few years, and it finally exploded, sometime last year.

As Stackoverflow grew, its reputation grew exponentially. Where once it was a haven for professional and enthusiasts developers, today it’s a mainstream help-your-fellow-developer site. This state of affairs is making a lot of people mad and angry. Question/user quality is falling from year to year. Once, people would come to ask decent questions, now this site is full of mediocrity. I would like to rectify this as much as I can.

I will write this article from the perspective of jQuery Mobile but most of things I’m going to say here easily translates to any other topic. If you want to know my Stackoverflow nick is gajotres and I am mainly active in jQuery/jQuery Mobile tags.

Note: If this tutorial was helpful, you need further clarification, something is not working or you have a request for another Ionic post? Furthermore, leave me a comment below if you don't like something about this blog, if something is bugging you, don't like how I'm doing stuff here. Feel free to comment below, subscribe to my blog, mail me to Thanks and have a nice day!

Before you write a question

Search, search, search and research before you even open new question window. Stackoverflow is a several years old site; there’s a good chance this problem is already solved and answered. If you can’t google it, then open a topic specific tag and try looking for it by yourself. There’s a good chance your answer is somewhere out there. If you don’t do it yourself, someone else will, thus closing your question as a duplicate. Remember “close-warriors” don’t like previously asked questions. The only thing they want is to close your question; myself included. Nothing personal, every duplicate question will water down a particular topic.

Several things could happen if your question is closed as duplicate/on hold:

  • Your question will get closed and linked to a similar question. This other issue may or may not hold an answer to your problem.
  • There’s a good chance this linked question will have nothing to do with your question, and you will be left without a proper answer.
  • You may want to open another (same) question trying to argue that last one was wrongfully closed. 99% of time someone will also close this question, additionally reporting you for spamming.
  • A portion of Stackoverflow users will downvote your question that will severally affect your future questions. Stackoverflow users usually avoid answering questions from low reputation users. If a lot of your questions are deemed low quality, site will permanently close your account.

Before we go any further, make sure to bookmark every similar question/answer. You may use them while writing your future question. Just link them to something you looked but didn’t found useful. This will show that you have spent some time searching for your answer.

What not to ask

  • Never ask someone to do your job or assignment, show at least some effort. Instead of asking as to do your job, try it yourself, stumble and ask how to solve your current problem.
  • Never ask for opinions. This is one of the options when someone want to close your question. If you need advice, got to your relevant tag, look at the list of top tag contributors. Pick 2-3 of the list, send them an email and kindly as for the advice. People will usually respond, including me.

Question title

Now you are ready to ask your question. First write your title carefully, it should not be too long or too short. Usually, everything you want to know should be summarized in the question title.

For example, take a look at this purely written question title: How to click a div on jquery. If you want to understand why open this link and read mentioned the question. You will see that question title (no matter how much grammatically it was badly written) has nothing to do with the question itself. It had taken just 8 minutes before it was permanently closed.

On the other hand this is an example of correctly written title: how to pass parameter in jquery using .on?. It doesn’t matter if this question starts with lowercase letter and on keyword is not mentioned as a function. It’s perfectly clear what user wants to know.

Question content – What have you done so far

This is an important part of your question. Before you write anything, think carefully what you want to say. Imagine you’re asking someone directly about this question, write that down, and make sure it make sense. Don’t write to much, people don’t prefer to read a longer question, this is not a dissertation. At the same time don’t make it to short, everyone needs to understand a point of your question.

Next thing, especially if you are asking a code related question, make sure you add part of your code. I am talking about problematic code, don’t overdo it, add the only code you think it is relevant to your question, nothing else.

Even better, if possible, add a working example of your code. For example, if your question is JavaScript related you can use jsFiddle, or any other similar online tool. Use it to create a working example and post it as a part of your question, it will improve your chances significantly.

For example take a look at templates I’m using for my jQuery Mobile answers:

  • jQuery Mobile 1.2 template – link
  • jQuery Mobile 1.3 template – link
  • jQuery Mobile 1.4 template – link

If you are working on other languages, if possible, use a tool like, or any other similar online tool. There’s even a online tool for SQL examples, find it here.

If you manage to create a working example, don’t forget to tell us how to recreate your problem. You would be amazed how many people forget to do that.

Let me show you several examples of well written questions: here, here and here.

Here’s an example of very well written question. As you can see, everything you need to know is written

One last thing, don’t forget to tell us what you have done. Your question would get closed immediately if you asked your question without even trying to solve it by yourself. When you show us what you have already done, we can know where to look further plus you will show us that you spent some effort trying to solve mentioned the problem.

Question content – What have you expect from us

In the end, you should elaborate your problem, what’s happening and what do you expect from us. This is the most important part of your question. It doesn’t matter how well is your question written if you can your problem correctly. For example, here’s a almost well written question. You should notice that question owner never told what’s wrong with his code, error messages, missing data.

After question was asked

This is important, when you ask your question don’t immediately leave, stay at lease half an hour up to one hour looking at your question. Usually, people will leave you initial comments asking for more information, you need to be able to provide them. You will not get sanctioned because of this, but there’s a good chance other users will disregard your question and go further. Which is specially dangerous if your question is part of the heavily used tag, in a no time your question will end up on 2,3 or 4th page, forgotten and unsolved.

If you receive an answer that has solved your question please consider accepting it by clicking the check-mark. This indicates to the wider community that you’ve found a solution and gives some reputation to both the answerer and yourself. There is no obligation to do this. This will significantly improve chances of your question getting answered in the future.

Last but not least, never add follow-up questions to your initial question. The community doesn’t like this. Accept your answer (if it is correct) and open the new question.

Who Am I?

Between working as a senior Java developer in one of the largest insurance companies in the world and traveling, in my free time, I work as a professional mobile development adviser. I'm also a major jQuery Mobile supporter back at StackOverflow and a forum moderator at the official Ionic Framework forum.


4 thoughts on “How to ask a good Stackoverflow question”

  1. I read this article after reviewing another post around jquery mobile. I’d let to share some insight from a new user of the forums. What you have outlined is pretty standard forum etiquette from posting and researching questions. However a few things that have frustrated me and have actually caused the duplicate post issue is the inability to comment on existing threads due to some lame reputation point system.

    I have found that some of what I would like to know has already been posted. Perhaps not exactly correct, but close and a simple followup on the same topic would get the information I was after, problem is, I can’t due to the reputation points.

    Further to that, searching and reviewing existing posts for an answer isn’t always straight forward. For a question I may have, might be very close to another but the subject title maybe so far off what I consider that finding that similar post is extremely difficult, if not impossible. Then, I get a duplicate post lock applied to my topic. Great. Another issue, even though some posts are close to what I’m looking for but I still can’t find a solution, so I post a question. I get a “close warrior” with a chip on his shoulders around a post that he may deem beneath him to answer or annoyed by some aspect that he knocks down my reputation points as well as gives zero help to my question.

    Many of the newbie’s that you see on these forums have essentially been forced here by google developers support directing them to find their answers on these forums. That being said, yes, there will be some diluted questions, and yes there also maybe some annoyances to posts, but limiting the ability for users to comment on threats only makes the situation worse. And for those “close warriors” who find it beneath them to answer some newbie questions, they should be reminded that they were once newbies as well and were annoying pro’s with some of their questions.

    Just something to consider as part of forum etiquette for the reputation collectors.


Leave a Reply