# Transpiler

> A tool that turns code in one language into another. People can still read it.

**Field:** Software Development  
**Category:** Web Development  
**Also known as:** Source-to-Source Compiler, Transcompiler

## Think of it like

Think of it like a story put into plain words. Then more kids can read it.

## Definition

A transpiler turns code in one language into code in another. On the web, it most often turns TypeScript or new JavaScript into older JavaScript. That older code runs in every browser. It is a kind of compiler, but its output is still code people can read. Babel and the TypeScript compiler are two well-known ones. It most often runs as part of the build.

## Example

Emma writes her app in TypeScript. Before it ships, a tool turns each file into plain JavaScript.

## Example code

```typescript
// in:  const total: number = 5;
// out: const total = 5;
```

The type note is removed, leaving plain JavaScript.

## Why it matters

It lets you write in a nicer language and still run everywhere.

## Common mistake

Thinking a transpiler checks your types. Some only strip them out, so run the type checker too.

## Three principles

- **Code to code.** Same level, new language.
- **Readable output.** Unlike machine code.
- **Part of the build.** Runs before you ship.

## Related terms

- [Compiler](https://learn.benibix.com/term/development/compiler)
- [TypeScript](https://learn.benibix.com/term/development/typescript)
- [JavaScript](https://learn.benibix.com/term/development/javascript)
- [JavaScript Bundler](https://learn.benibix.com/term/development/bundler)

## Told apart from

- [Transpiler vs Polyfill](https://learn.benibix.com/compare/transpiler-vs-polyfill): People think a transpiler can make any new feature work in an old browser, and it cannot. A transpiler rewrites how your code is written, such as taking out types. A polyfill adds a function the old browser does not have. Many sites need both.

---

Source: https://learn.benibix.com/term/development/transpiler
Author: Behnia Zarei (a developer in Vienna, Austria, who builds and teaches data, AI and business intelligence at BENIBIX)
Publisher: BENIBIX Learn (https://learn.benibix.com/)
Last updated: 2026-11-19
Licence: CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Quote freely with attribution.
