Toolvore

AI Code Explainer

Get a plain-English explanation of any code snippet.

This tool sends the text you enter to an AI provider to generate a response. Don't paste secrets or personal data. No files are uploaded.

The AI Code Explainer reads a snippet in any language and returns a plain-English account of it — the code comments you would have written if you had time: what the code does overall, a walk through the parts carrying the logic, and whatever bugs or gotchas the model notices on the way.

How to use it

  1. 1Paste the snippet into the Code snippet box — there is no language selector, so nothing has to be declared up front.
  2. 2Press Explain Code; the answer streams in as it is written, and the button turns into Stop if you want to cut it short.
  3. 3Copy the finished explanation with the button beside Result, or drop in a different snippet — each run replaces the last.

Example

Input
for (const [k, v] of Object.entries(o)) if (v == null) delete o[k];
Output
An overview saying the loop strips out every key whose value is null or undefined, then a walkthrough covering Object.entries, the loose == null test that catches both of those values in one comparison, and the fact that the deletion mutates the original object.

Described as a shape rather than quoted, because the wording differs on every run. The structure holds — overview, walkthrough, gotchas — since that is what the tool asks for, but the substance still needs checking against the code in front of you, particularly where a snippet is short enough to be ambiguous out of context.

What happens to your data

Unlike almost everything else on this site, this tool does not do its work in your browser. The snippet is wrapped in a fenced code block, posted as a single message to our /api/ai route, and relayed from there to Anthropic's Claude API to be read — so the code does leave your machine. Strip out API keys, connection strings, internal hostnames and anything under an NDA before pasting. Pressing Stop aborts both the stream and the upstream request, but only the reply is cut off: the code went with the opening request and cannot be recalled.

Last updated August 2026

Someone has left, and a file they wrote is now yours. Or a regular expression copied from an answer online has been in production for two years and nobody can say what it matches. Or a review has landed in your queue in a language you last wrote at university. The question underneath all three is the same: what does this do, and what will it do when the input is not the one it was written for?

Before you paste anything, decide what unit you are asking about. A whole function, with the constants and types it leans on, gets you an answer about behaviour. A fragment torn from the middle of a method — a loop reading three fields declared two hundred lines above — gets you an answer about syntax, because everything that decided the behaviour was left behind. No repository is opened and no import followed: what sits in the box is the whole world the explanation is built from.

The second thing to settle is that this is one question, not a conversation. Each run sends a single message and starts from an empty result, so there is no follow-up about line nine — narrow the snippet instead and run it again.

The common mistake is treating a fluent explanation as verification. It is a reading of code by something that cannot execute it: reliable where the code is ordinary, and most assured where a short snippet is ambiguous out of context.

How it works

Toolvore what leaves the page is a single message: the instruction Explain this code, then the contents of the box inside a triple-backtick fence carrying no language tag, so the language is inferred rather than declared. That message goes to an /api/ai route which limits requests per address, refuses a message longer than 40,000 characters, and passes the rest to Anthropic's API under a system prompt asking a senior engineer for three things in Markdown: what the code does overall, a walkthrough of the parts carrying the logic, and any bugs or gotchas. The reply streams back as plain text, rendered through marked and sanitised with DOMPurify before it reaches the page. The weakness is structural: the model sees the fenced text and nothing else — no imports resolved, no type definitions, no call sites, no runtime. Output is capped at 3,000 tokens, and a long file can hit that ceiling mid-walkthrough, ending on a bracketed line saying the answer was cut off.

Common use cases

  • Reading a function left behind by someone who has since left the team
  • Working out what a dense regular expression or one-line reducer matches
  • Reviewing a pull request in a language you rarely write
  • Making sense of a snippet copied from an answer online before it ships
  • Turning an undocumented utility into the start of a docstring
  • Getting a second reading of a loop that misbehaves on empty input

Frequently asked questions

How do I get to grips with a codebase I have just inherited?

Start from the edges rather than the middle. Find the entry points — the route handlers, the main function, the scheduled job — and follow one request the whole way through, ignoring everything it never touches. Read the tests next: they state what the previous author believed the code should do, which comments often no longer do. Then read the data, because the shape of the tables and payloads explains most of the code that moves them. Explaining individual snippets earns its place once you are inside that map and hit a function whose logic is dense.

Is it safe to paste code from work into an AI tool?

Not by default, and this tool is explicit about why: the snippet is posted to a server route and relayed to Anthropic's API, so it leaves your machine the moment you press the button. The response carries a no-store header and the route keeps no copy of what you typed, but neither of those undoes the sending. Treat anything under an NDA, any file carrying a key or a connection string, and anything whose comments name customers as ineligible. Where an employer has a policy on pasting source into third-party services, the policy decides this, not the tool.

How much code should I paste in one go?

The hard ceiling is 40,000 characters in one message, and above that the request is refused on length rather than quietly truncated. The practical ceiling sits lower. The reply is capped at 3,000 tokens, so a very long file gets an explanation that either skims everything evenly or stops mid-walkthrough with a bracketed note. One unit at a time reads better: a function, a class, a migration, a build target. If a file is long because it holds twelve unrelated helpers, send the one you care about.

Can minified or obfuscated JavaScript be explained?

Behaviour, yes; intent, no. Minification deletes exactly what a reader depends on — parameter names, function names, blank lines, comments — while leaving the logic intact, so an explanation can describe what the code computes and have nothing to say about why it exists. Run it through a formatter first so the structure is visible, and expect prose written in terms of a, b and n. Obfuscation goes further, rewriting control flow and hiding strings behind lookup tables, and explaining that is largely speculation. Bundled output adds one more problem: your fragment may straddle two modules.

Why do AI explanations sound confident and still get it wrong?

Because fluency and correctness come out of the same process. The text is generated to be a plausible account of what you supplied, and where the code is ordinary, plausible and true coincide. They separate at missing context: a helper the model cannot see, an override further up the class hierarchy, a library whose behaviour changed between versions. The tell is specificity about things absent from the snippet — a claim about what a called function returns, or about the order records arrive in. Anything asserted that the pasted lines do not show is the part to check.

Does an explanation count as a code review?

No — they look for different things. A review weighs a change against the codebase receiving it: whether a test covers the case that broke last time, whether this makes the next change harder. An explanation looks only at the lines in front of it. The system prompt does ask for bugs and gotchas, which catches the local kind — an off-by-one, a comparison treating null and undefined alike, an unhandled rejection — but silence is not a clean bill of health. A security audit needs what a snippet cannot show: where the input comes from and who may send it.

Should I turn the explanation into comments or documentation?

Use it as a draft and cut it hard. Explanations are written for someone meeting the code for the first time, while comments are read by people who already know the file, so much of a walkthrough becomes noise above the function. Keep the part that says why — the constraint forcing the odd branch, the reason the loop counts backwards — and delete anything restating what the line already says, because that kind of comment goes stale the first time the code changes and then misleads. Nothing it guessed about code it could not see belongs in a docstring.

How can you tell what language a piece of code is written in?

Usually from a handful of markers: significant indentation and def for Python, braces with semicolons across the C family, fn and let mut for Rust, angle-bracket generics and public class for Java, a shebang on the first line of a shell script. Ambiguity is real for short fragments — three lines can be valid JavaScript, TypeScript and PHP at once, and a SELECT reads much the same in half a dozen dialects. Nothing is declared here: the snippet goes into a fence with no language tag, so the reading is inferred from the code itself.