How do I ask a good question? - Help Center (original) (raw)

We’re happy to help you, but in order to improve your chances of getting an answer, here are some guidelines to follow:

Make sure your question is on-topic and suitable for this site

Stack Overflow only accepts certain types of questions about programming and software development, and your question must be written in English. If your question is not on-topic or is otherwise unsuitable for this site, then it will likely be closed.

Closure is not the end of the road for questions; it is intended to be a temporary state until the question is revised to meet our requirements. However, if you fail to do that, or it is impossible to do so, then the question will stay closed and will not be answered.

Since you're reading this page, hopefully you will post a suitable, on-topic question from the outset, thus eliminating the need for the closure and reopening process!

Search, and research

Before posting a question, we strongly recommend that you spend a reasonable amount of time researching the problem and searching for existing questions on this site that may provide an answer. (Stack Overflow has been around for a long time now, so many common questions have already been answered.)

Make sure to keep track of what you find when researching, even if it doesn't help! If you ultimately aren't able to find the answer to your question elsewhere on this site, then including links to related questions (as well as an explanation of why they didn't help in your specific case) will help prevent your question from being marked as a duplicate when you ultimately do ask it.

Write a title that summarizes the specific problem

The title is the first thing that potential answerers will see. If your title isn't interesting, they won't read the rest. Also, without a good title, people may not even be able to find your question. So, make the title count:

Examples:

Introduce the problem before you post any code

In the body of your question, start by expanding on the summary you put in the title. Don't just skip straight to the code! It is often helpful to provide some background contextual information, and describing your problem in words is almost as important as describing it with code.

Explain how you encountered the problem you're trying to solve, and any difficulties that have prevented you from solving it yourself. The first paragraph in your question is the second thing most readers will see, so make it as engaging and informative as possible. You want to make a good first impression.

Help others reproduce the problem

Not all questions benefit from including code, but if your problem is with code you've written, you should include some. But don't just copy in your entire program! Not only is this likely to get you in trouble if you're posting your employer's code, it likely includes a lot of irrelevant details that readers will need to ignore when trying to reproduce the problem. Here are some guidelines:

Include all relevant tags

Try to include a tag for the language, library, and specific API(s) that your question is about. If you start typing in the tags field, the system will suggest tags that match what you've typed—be sure to read the descriptions given for them to make sure they're relevant to the question you're asking!

If your question is about a problem in a specific version of a language, library, and/or API, you may want to add a version-specific tag, such as "[python-3.8]". If you do use a version-specific tag, make sure to also include the main, non-version–specific tag (e.g., "[python]").

See also: What are tags, and how should I use them?

Proofread before posting!

Now that you've finished writing your question, take a deep breath and read through it from start to finish. Pretend you're seeing it for the first time: does it make sense? Can someone without all of your context and background knowledge understand it? Try reproducing the problem yourself, in a fresh environment and make sure you can do so using only the information included in your question. Add any details you missed and read through it again. Re-read your title, and make sure that it succinctly and accurately describes the problem.

Also, spelling, grammar, and punctuation are important! If you're not comfortable writing in English, ask someone to proofread it for you.

Respond to feedback after posting

After you post, don't run away too fast—leave the question open in your browser for a bit to see if anyone comments. If you missed an obvious piece of information, be ready to respond by editing your question to include it. If someone posts an answer, be ready to try it out and provide feedback!

Sometimes, you may find yourself frustrated by the comments. Maybe they make suggestions that you have already tried. Maybe they totally misunderstand your problem. Try not to get frustrated—people reading and commenting on your question generally want to help! Take these types of comments as suggestions of how to improve your question. Remember that you can edit your question at any time! (If someone does leave a rude or irrelevant comment, flag it for moderator attention so it can be removed.)

Look for help asking for help

In spite of all your efforts, you may find your questions poorly-received. Don't despair! Learning to ask a good question is a worthy pursuit, and not one you'll master overnight. Here are some additional resources that you may find useful: