Sometimes, but not in the way most people imagine. There is no scanner that reads a file and reports "written by ChatGPT" with certainty. Instead there are four different kinds of checks, each with its own strengths and blind spots: tools that compare submissions with each other, classifiers that estimate whether text or code looks machine-written, people who read the code, and conversations where the author has to explain it. This page walks through all four. Statements about specific products and about OpenAI come from their official pages, which we read in October 2026.
What OpenAI has said about AI detection
The company that makes ChatGPT is a useful starting point. In January 2023 OpenAI released its own classifier for indicating AI-written text. The announcement said the classifier was not fully reliable: on its challenge set it correctly identified 26% of AI-written text as likely AI-written, while wrongly labelling human-written text as AI-written 9% of the time. Among its listed limitations, it said the classifier was unreliable on code. A note added to the same page says that as of July 20, 2023 the classifier is no longer available due to its low rate of accuracy.
OpenAI's educator FAQ goes further. Asked whether AI detectors work, it answers, in short, not in OpenAI's experience. It says its own detector labelled human-written text, including Shakespeare and the Declaration of Independence, as AI-generated, and that ChatGPT itself cannot tell you whether something was AI-written. None of this means detection is impossible, but it sets a sensible expectation: any single automated verdict deserves caution.
1. Similarity tools
Programming courses have used similarity checkers for decades. The MOSS page at Stanford describes it as a system for detecting software similarity, and Gradescope's Code Similarity guide says its report shows how similar students' programs are to each other within one assignment and does not automatically detect plagiarism.
These tools do not look for AI at all. They can only show that two or more submissions resemble each other. That matters for ChatGPT because the same prompt can produce similar answers for different students, and a similarity tool will surface that overlap. A single generated solution that matches nobody else will not stand out. We cover this in more detail in does MOSS detect AI code.
2. AI classifiers and detectors
This is what most people mean by "detection": a model that reads the code and estimates how likely it is to be AI-generated. The tools vary a lot, and their published support for code varies too. Turnitin's AI writing FAQ, for example, says its model removes text that appears to be code before scoring, does not reliably detect AI-generated code, and that Turnitin is not pursuing ChatGPT code detection at this time. More in does Turnitin detect AI code.
Independent research has found the general problem hard. A 2024 study by Pan and colleagues tested five AI content detectors on code generated by ChatGPT and concluded that existing detectors performed poorly at telling human-written code from AI-generated code. Detectors built specifically for code, including the one on this page, look at style patterns such as comment habits, naming and structure. They can be useful, but they can be wrong in both directions, especially on short snippets, very standard algorithms or code that has been heavily edited.
3. Human review
People who grade or review code see a lot of it, and they notice things a tool does not measure. A submission that is far more polished than the same student's earlier work, uses techniques the course has not covered, or solves a slightly different problem than the one set will catch a reader's attention. So will tell-tale extras such as a comment on every line or a demo block nobody asked for. None of these is proof either, since strong students and careful developers can produce the same features, but human review is often where questions start. Our guide on how to tell if code was written by ChatGPT lists these signals and their false positives.
4. Oral checks and process evidence
The most reliable check is not a tool. When an instructor or interviewer asks the author to explain a solution, justify a design choice or make a small change on the spot, it quickly becomes clear whether the person understands the code. Process evidence works alongside this: a commit history that grows in small steps, drafts, and, where a course allows AI use with disclosure, the conversation itself. OpenAI's educator FAQ suggests exactly that, describing teachers who ask students to share their ChatGPT conversations as a way of showing their work.
Putting the four together
- Similarity tools catch shared code, including several students submitting near-identical generated answers, but cannot say where the code came from.
- AI classifiers give a probability, not a fact. Their makers and independent researchers both describe real error rates.
- Human review notices mismatches with the author's usual work and with the course, and decides who to talk to.
- Oral checks settle most questions, in either direction.
So the honest answer is that ChatGPT code can be noticed, usually through a combination of these checks rather than any one of them, and that no single check should be treated as proof. If your course or employer allows AI help, follow its disclosure rules. If it does not, the safest assumption is that a conversation about your code is always possible.
Checking your own code
You can use the detector at the top of this page to see how your code reads. Paste a complete function or file section, then read the reasons it gives rather than focusing on the score. If a flag surprises you, ask yourself whether you could explain that part of the code clearly. If you wrote it yourself and it was still flagged, our page on what to do if your code was flagged as AI explains how to respond calmly with evidence.
Frequently asked questions
Can ChatGPT code be detected with certainty?
No. No tool we know of can prove that code came from ChatGPT. OpenAI itself retired its own AI text classifier because of its low accuracy, and said at launch that the classifier was unreliable on code. What exists are signals, from similarity reports, detectors and people, that make AI use more or less likely.
Does ChatGPT put a watermark in code?
The OpenAI pages we read do not describe any watermark for code generated by ChatGPT. When it retired its classifier, OpenAI said it was researching more effective provenance techniques for text, which is not the same as having a working watermark for code.
Can I ask ChatGPT whether it wrote some code?
That does not work. OpenAI's educator FAQ says ChatGPT has no knowledge of what content could be AI-generated and that its answers to questions like 'did you write this?' are random and have no basis in fact.
Which is more likely to catch AI code: a tool or a person?
In most courses, a person. Tools produce flags that someone has to interpret, and the most decisive check is usually a conversation where the author explains or changes the code. Tools mainly decide who gets asked.
Is it worth running my own code through a detector?
It can be useful as a reading aid. A detector will not give you a verdict you can rely on, but its reasons show which parts of your code look generated to a reader, so you know what you might be asked about.
Try the detector
Have a snippet you are unsure about? Paste it into the free AI Code Detector to get a verdict, an AI probability and the reasons behind it. No sign-up, and your code is not stored.