Skip to content

AI tool · Code

Code converter

Paste code and get it in JavaScript, TypeScript, Python, Java, Go, C#, PHP or Ruby, behaving exactly the same, on any of 27 models. We ran every model's conversions against tests to see whose still work.

Runs on Plus and Pro, on the model you pick

Up to 1,500 characters.

Try an example:

By running it, you agree to the Terms and Privacy Policy and confirm you’re 18 or older. We keep what you send and its answer for 7 days, or in your account if you sign up.

Test runs checked .

Code converter: three examples

Three inputs and the conversion GPT-6 Luna gave each, made once on September 29, 2026 and shown as it came back. The example buttons in the box above show the same.

Python to JavaScript

def word_counts(text): counts = {} for word in text.lower().split(): counts[word] = counts.get(word, 0) + 1 return counts

```javascript
function word_counts(text) {
  const counts = Object.create(null);
  for (const word of text.toLowerCase().split(/\s+/u).filter(Boolean)) {
    counts[word] = (counts[word] ?? 0) + 1;
  }
  return counts;
}
```

Source: Python. JavaScript uses Unicode whitespace splitting to match Python’s `split()` behavior; the result has no inherited object properties.
JavaScript to Python

function groupBy(items, key) { return items.reduce((groups, item) => { (groups[item[key]] ||= []).push(item); return groups; }, {}); }

```python
from typing import Any, Hashable, Iterable

def groupBy(items: Iterable[Any], key: Any) -> dict[Hashable, list[Any]]:
    groups: dict[Hashable, list[Any]] = {}
    for item in items:
        group_key = item[key]
        if group_key not in groups:
            groups[group_key] = []
        groups[group_key].append(item)
    return groups
```

Source language: JavaScript. Python dictionary keys must be hashable; JavaScript coerces object keys to strings (except symbols), so non-string keys can behave differently.
Java to Go

public static boolean isLeapYear(int year) { return (year % 4 == 0 && year % 100 != 0) || year % 400 == 0; }

```go
func isLeapYear(year int) bool {
	return (year%4 == 0 && year%100 != 0) || year%400 == 0
}
```

Source language: Java.
Go’s `%` has the same sign behavior as Java’s for negative integers, so the result is preserved.

Which AI model is best at this? We tested every one

In our test runs of 5 Code converter inputs on 27 models, GPT-6 Luna, Claude Haiku 5.5, DeepSeek V4.1 Flash and 21 more passed the most: 5 of 5. That includes Claude Haiku 5.5 (an everyday model on every plan).

Run on November 19, 2026: 5 inputs on 27 models, each with this tool's own instructions.

Each model's results on the tool's test inputs
ModelPassedHard onesMessages used on ProCost per runTime per run
GPT-6 LunaOpenAI5 of 52 of 21 each, of 60 a day on Pro$0.000111.0 s
Claude Haiku 5.5Anthropic5 of 52 of 21 each, of 60 a day on Pro$0.00054.8 s
DeepSeek V4.1 FlashDeepSeek5 of 52 of 21 each, of 60 a day on Pro$0.00093.1 s
Gemini 3.8 FlashGoogle5 of 52 of 21 each, of 250 a month on Pro$0.00042.9 s
GLM 5.3Z.ai5 of 52 of 21 each, of 250 a month on Pro$0.00092.1 s
GPT-6.1 TerraOpenAI5 of 52 of 21 each, of 250 a month on Pro$0.002511.4 s
DeepSeek V4 ProDeepSeek5 of 52 of 21 each, of 250 a month on Pro$0.006912.8 s
Mistral Large 4Mistral5 of 52 of 21 each, of 250 a month on Pro$0.009349.8 s
Grok 4.7xAI5 of 52 of 21 each, of 250 a month on Pro$0.021046.5 s
Claude Sonnet 5Anthropic5 of 52 of 21 each, of 125 a month on Pro$0.00323.0 s
GPT-6.1 SolOpenAI5 of 52 of 21 each, of 125 a month on Pro$0.003418.7 s
Kimi K3Moonshot5 of 52 of 21 each, of 125 a month on Pro$0.00364.3 s
GPT-6 SolOpenAI5 of 52 of 21 each, of 125 a month on Pro$0.00419.3 s
Gemini 4 HydrogenGoogle5 of 52 of 21 each, of 125 a month on Pro$0.00557.8 s
Kimi K3.1 ProMoonshot5 of 52 of 21 each, of 125 a month on Pro$0.006715.3 s
GPT-6.2 SolOpenAI5 of 52 of 21 each, of 125 a month on Pro$0.00697.9 s
Gemini 3.1 Pro (preview)Google5 of 52 of 21 each, of 125 a month on Pro$0.00759.8 s
Claude Sonnet 5.5Anthropic5 of 52 of 21 each, of 125 a month on Pro$0.00876.5 s
Gemini 4 ArgonGoogle5 of 52 of 21 each, of 62 a month on Pro$0.00208.2 s
Gemini 4 CarbonGoogle5 of 52 of 21 each, of 62 a month on Pro$0.012431.7 s
Claude Opus 5.5Anthropic5 of 52 of 21 each, of 62 a month on Pro$0.02249.7 s
GPT-6 AstraOpenAI5 of 52 of 21 each, of 31 a month on Pro$0.019112.7 s
Claude Fable 5.1Anthropic5 of 52 of 21 each, of 31 a month on Pro$0.03518.4 s
Claude Fable 5.2Anthropic5 of 52 of 21 each, of 31 a month on Pro$0.043311.0 s
GLM 5.3 FlashZ.ai4 of 52 of 21 each, of 60 a day on Pro$0.00012.3 s
GPT-6.2 AstraOpenAI4 of 52 of 21 each, of 31 a month on Pro$0.01828.6 s
Claude Haiku 4.5Anthropic3 of 51 of 21 each, of 250 a month on Pro$0.00111.7 s
Passed: of the 5 test inputs, how many answers passed their check (an answer the provider failed to give isn't counted). Messages used: what each run counted as on Pro, and Pro's count on the model. Cost: what OpenRouter charged us per run, on average; in llmwise you pay per message, not per token. Time: from sending to the whole answer.

Side by side: python's % on negative minutes

The same input on GPT-6 Luna and Claude Haiku 5.5, as each answered it, unedited.

Convert this code, in one code block, keeping the same names and exactly the same behaviour for every input. Then at most three lines on the differences you handled.

---
def clock(minutes):
    m = minutes % 1440
    return f"{m // 60:02d}:{m % 60:02d}"
GPT-6 Luna
```javascript
function clock(minutes) {
  const value = BigInt(minutes);
  const m = ((value % 1440n) + 1440n) % 1440n;
  const hours = m / 60n;
  const mins = m % 60n;
  return `${String(hours).padStart(2, "0")}:${String(mins).padStart(2, "0")}`;
}
```

Source: Python. BigInt preserves integer precision and the modulo is adjusted to match Python’s nonnegative remainder for negative inputs.
Claude Haiku 5.5
```javascript
function clock(minutes) {
  // Python's % always returns a result with the sign of the divisor (0..1439 here),
  // so normalise negative inputs the same way.
  const m = ((minutes % 1440) + 1440) % 1440;
  // Python's // on non-negative integers equals Math.floor; keep it explicit.
  const hours = Math.floor(m / 60);
  const mins = m % 60;
  return `${String(hours).padStart(2, "0")}:${String(mins).padStart(2, "0")}`;
}
```

Source language: Python. Negative inputs are wrapped with a double modulo so they match Python's floored modulo instead of JavaScript's truncated remainder. Zero-padding to two digits mirrors Python's `:02d` format.

How the inputs are scored

  • Tests: the reply's JavaScript runs in a locked-down sandbox against our tests, edge cases included; it passes only if every test does.

The inputs: a python slugify, java running totals, ruby initials, with extra spaces, python's % on negative minutes, and python's sort order, capitals first. Every model gets the tool's own instructions and up to Pro's reply limit. The method is the same as our other test runs.

How to use the Code converter

  1. Paste the code: a function, a class or a short script. Up to 1,500 characters.

  2. Pick the language to convert it into.

  3. Press “Convert”. It runs on your plan (Plus or Pro) on the model you pick, and the whole answer streams in.

  4. Run the original and the conversion on the same inputs, edge cases included, before you replace anything.

Tips for a better answer

  • Show how it's called

    Paste the function with the code that calls it, or an example input and output. The conversion then matches how it's really used.

  • Name the version

    Say which runtime you're on (“Node 22”, “Python 3.12”, “Java 21”). Newer versions have built-ins that make the code shorter.

  • Small pieces

    Convert one function at a time and test each one. A 2,000-line file converted in one go hides its mistakes.

  • Tests that run on both

    Ask the same model for tests of the original's behaviour, then run them on both versions.

What a good conversion looks like

  • Same inputs, same outputs

    Run the original and the conversion on the same inputs, including an empty one, a negative number and text with odd spacing. Where the outputs differ, the conversion is wrong.

  • Arithmetic on negatives

    Python's -7 % 3 is 2; JavaScript's is -1. Python's // rounds down; a naive Math.trunc rounds toward zero. Check every % and division when negatives can occur.

  • Library functions that look alike

    Ruby's split() drops empty pieces; JavaScript's split(" ") keeps them. Python sorts “B” before “a”; localeCompare doesn't. These small differences are where converted code quietly breaks.

  • Idiomatic, not literal

    A good conversion uses the target language's own style (a list comprehension becomes map, a dict becomes an object or Map), not a line-by-line transliteration.

What you need to run it, and what a run gives

  • Running it takes a plan, Plus or Pro. There's no free plan or trial: a plan is paid at checkout and renews every month until you cancel. Cancel in two clicks in Settings → Billing and you keep your plan to the end of the month you paid for. llmwise accounts are for people 18 and older.

  • Paste up to 20,000 characters in a run. It runs on the model you pick, shows the whole answer, and you can carry on in the chat with any model your plan has, or ask another model the same thing.

  • A run counts on your plan like any other message: the table above shows what one counted as on Pro, model by model.

More AI tools are on the tools page, and what each plan gives is on pricing.

Questions

Is the code converter free?

No: there's no free plan or trial. It runs on Plus and Pro, on any model your plan has; Claude Fable 5.2, GPT-6.2 Astra, and their earlier versions need Pro. Paid monthly from the day you start. Cancel in two clicks in Settings → Billing.

Which languages can it convert between?

From any common language: it reads the code you paste and names the language it found. Into JavaScript, TypeScript, Python, Java, Go, C#, PHP or Ruby.

Does the converted code actually work?

Our test runs gave every model five functions in Python, Java and Ruby, had it convert each one to JavaScript, and ran the result against tests in a sandbox. We test conversions into JavaScript because that's what our sandbox runs; the page shows which models passed.

Can it convert a whole file?

Yes: paste up to 20,000 characters, a whole file or module, on any of 27 models, and ask follow-ups in the same chat (“now add types”, “use async/await”).

What about libraries and frameworks?

It maps each library call to the target's nearest equivalent and says when there isn't one. A framework migration (Django to Express, say) is more than a conversion: do it file by file, and test each one.

Which AI is best for this, in your tests?

In our test runs of 5 Code converter inputs on 27 models, GPT-6 Luna, Claude Haiku 5.5, DeepSeek V4.1 Flash and 21 more passed the most: 5 of 5. That includes Claude Haiku 5.5 (an everyday model on every plan). The table on this page has every model's result, what a run counts as on Pro, and the time it took.

Claude, GPT, Gemini, DeepSeek, Grok, Kimi, GLM, and Mistral, in one chat.

See what a message costs before you send it. Every plan is month to month: cancel in two clicks. Sign in with an email link, no password.