This is an original, short CODE_OF_CONDUCT.md template written by Markdific. Replace the placeholders, especially the reporting contact, and make sure the people named in it can enforce it. If you prefer a widely adopted standard text, see the section on Contributor Covenant below.
Need it as a document? Paste the filled-in template into the free Markdown to Word or Markdown to PDF converter.
Code of conduct key facts
- Name the file
CODE_OF_CONDUCT.mdand put it in the repository root, thedocsfolder, or the.githubfolder. GitHub uses the first one it finds, checking.github, then the root, thendocs. - On GitHub, typing
CODE_OF_CONDUCT.mdas a new file name shows a Choose a code of conduct template option. Using it requires write access to the repository. - A public repository named
.githubcan hold a default code of conduct for every repository in the account that does not have its own. - If you use a code of conduct written by someone else, follow that source's attribution guidelines.
- Name a real reporting contact, and include a backup for reports about that person.
- Adopt only rules your maintainers can and will enforce.
Copyable Markdown code of conduct template
# Code of conduct
## Purpose
[Project name] is a community of people who use and build [short description of the project]. We want participation to be respectful and free of harassment for everyone, regardless of background or identity. This code of conduct explains what we expect, how to report a problem, and how we respond.
## Expected behavior
- Be respectful and considerate, including when you disagree.
- Assume good intent, and ask questions before drawing conclusions.
- Give and accept constructive feedback about work, not about people.
- Use language that is welcoming and that others can understand.
- Respect people's time, boundaries, and privacy.
- Take responsibility for mistakes and correct them.
## Unacceptable behavior
- Harassment, intimidation, or threats, in public or in private
- Insults, demeaning comments, or personal attacks
- Discriminatory jokes or language
- Unwelcome sexual attention or content
- Sharing someone's private information without their permission
- Repeatedly disrupting discussions, or continuing an interaction after being asked to stop
- Encouraging any of the behavior above
## Scope
This code of conduct applies in all project spaces, including [the repository, issue tracker, pull requests, discussions, chat, mailing lists, and events]. It also applies when someone represents the project elsewhere, for example by using an official account or speaking on the project's behalf.
## Reporting
If you experience or witness unacceptable behavior, report it to [contact email or form]. Reports are read by [names or team].
If your report involves one of those people, contact [backup contact] instead.
Include what happened, when and where it happened, who was involved, and any links or screenshots. You may report anonymously, though this can limit our ability to follow up.
We will acknowledge your report within [number] days and keep the reporter's identity confidential, sharing details only with the people who need them to handle the report.
## Enforcement
The [moderation team or maintainers] will review each report and decide on a response. Depending on the severity and history of the behavior, responses may include:
- A private conversation or written request to change the behavior
- A formal warning
- Removal of comments, commits, or other content
- A temporary ban from some or all project spaces
- A permanent ban from the project
Anyone asked to stop unacceptable behavior is expected to stop immediately.
## Appeals
If you disagree with an enforcement decision, contact [appeals contact] within [number] days. Someone who was not involved in the original decision will review the appeal.
## Changes to this code of conduct
We may update this document. Changes are made through pull requests to this repository, and the history is visible in version control.
Last updated: [YYYY-MM-DD]
What a code of conduct is for
A code of conduct gives contributors a shared reference for acceptable behavior and gives maintainers a published basis for acting when it is not met. Without one, problems tend to be handled case by case, which feels arbitrary to the people involved.
It also tells newcomers how to get help. The reporting section is the most important part of the file: a contact that works, a backup for conflicts of interest, and a statement of what happens after a report.
Write enforcement you can carry out
GitHub Docs suggests considering whether you can enforce a code of conduct before adopting it. A single maintainer cannot run a five-person moderation process. Write the enforcement and appeals sections to match the people you have:
- Name who reads reports, and give a second contact for reports about them.
- List the actions you can take on the platforms you use, such as hiding comments, blocking users, or removing someone from a chat server.
- Set an acknowledgment time you can meet.
- Keep a private record of reports and decisions so that responses are consistent over time.
Contributor Covenant and other standard codes
Many projects adopt an existing code of conduct instead of writing their own. One of the most widely adopted is the Contributor Covenant, published by the Organization for Ethical Source. Its site says it has been adopted by thousands of communities and is available in over 40 translations. GitHub's Choose a code of conduct template option offers common codes of conduct you can fill in.
A standard code has advantages: contributors may already know it, and it has been reviewed by many communities. If you adopt one, use its current text as published, fill in its contact fields, and keep its attribution section. Each version is published under its own license terms. The Contributor Covenant 3.0 page states that it is licensed under CC BY-SA 4.0, which requires attribution and requires adaptations to be shared under the same license. Check the license notice on the version you adopt.
An original code, like the template on this page, is shorter and easier to tailor. Either choice works if the reporting contact is real and the maintainers enforce it.
Completed code of conduct excerpt
## Reporting
If you experience or witness unacceptable behavior, report it to
conduct@example.org. Reports are read by Dana Lee and Sam Ortiz.
If your report involves Dana or Sam, contact Priya Shah at
priya@example.org instead.
We will acknowledge your report within 3 days.
## Appeals
If you disagree with a decision, email appeals@example.org within
14 days. A maintainer who was not involved will review it.
The excerpt names who reads reports, provides a backup contact, and gives specific times. The names, addresses, and times are fictional.
What to include in CODE_OF_CONDUCT.md
| Section | What to write |
|---|---|
| Purpose | Who the community is and why the code exists |
| Expected behavior | Concrete behaviors you want to see |
| Unacceptable behavior | Concrete behaviors that are not allowed |
| Scope | Spaces and situations the code covers |
| Reporting | Contact, backup contact, what to include, confidentiality |
| Enforcement | Who decides and the range of possible actions |
| Appeals | How to contest a decision and who reviews it |
| Changes | How the document is updated and when it was last changed |
Code of conduct FAQ
Where should CODE_OF_CONDUCT.md go?
In the repository root, the docs folder, or the .github folder. GitHub checks .github first, then the root, then docs, and uses the first file it finds. Link it from README.md and CONTRIBUTING.md.
Should I use the Contributor Covenant or write my own?
Use the Contributor Covenant if you want a widely recognized text and can follow its license and attribution terms. Write your own if you need something shorter or specific to your community. In both cases, name a real reporting contact.
Can one code of conduct apply to all my repositories?
Yes, on GitHub. Add CODE_OF_CONDUCT.md to a public repository named .github in your organization or personal account. GitHub uses it for any repository that does not have its own.
What is the difference between a code of conduct and CONTRIBUTING.md?
A code of conduct covers behavior and enforcement for everyone in the community. CONTRIBUTING.md covers the process for contributing: issues, setup, pull requests, and review. The contributing guide should link to the code of conduct.
Does a small project need a code of conduct?
It helps once people other than the maintainer participate. Even a short file with expected behavior and a reporting contact tells contributors how problems will be handled.
Related templates
- CONTRIBUTING.md template
- SECURITY.md template
- GitHub issue template
- Pull request template
- README template
- CHANGELOG.md template
- Bug report template
- All Markdown templates
