Compiler vs Transpiler

Mohasin Haque
3 min readJan 12, 2022


Hello and welcome to another blog. In this blog I am going to talk about Compiler and Transpiler. So lets dive deep!


  • Compiler
  • Working of Compiler
  • Transpiler
  • Working of Transpiler
  • To Summarise and Main Difference
  • End Note


The term compiler was coined by American computer scientist Grace Hopper, who designed one of the first compilers in the early 1950s.

As we all know that computers only understand binary language but we people don’t. So to translate our code in binary language we need compilers.
Basically, a compiler is a program which converts high level language to low level language. OR in more simpler terms we can say that it takes the code written by us in human understandable language to the language which machines understand(binary).
Now if talk about JavaScript, It has no compiler unlike other programming languages such as cpp and python have. That’s why it is also called scripting language.

Working of Compiler

Whenever we write some code and when we compile it the compiler scans the whole code and check for errors etc. and after checking it converts the source code to machine code and also generates intermediate object code which further requires linking, hence requires more memory. Compiler also optimise the code so that it can run quickly and takes less memory space. The execution time is fast in the compilers. Programming languages like C, C++, java uses compilers.


Unlike compilers, Transpilers convert code to code. Transpilers also known as source-to-source compiler because it takes source code written in one language and transform it into another language that has a similar level of abstraction. Let us understand it with an example, ES6 is latest
and ES5 is its older version. Most of the browser engine supports the old version of ECMA. So developers use transpiler to run the code to its lower version also. Babel is a transpiler which will convert ES6 code to ES5 or lower versions so that it could run easily. Typescript transpiler also converts Typescript code to JavaScript.

Working of Transpiler

A transpiler first parses the code and extracts the keywords, variables etc. Then it forms an abstract syntax tree to suit the targeted language. Typescript is a high level language but after it’s transpiled it’s turned into JavaScript (another high level language). Or Babel for example can transpile ES6 JavaScript code into ES5 JavaScript.

To Summarise and Main Difference

Compiler usually produces a directly usable artifact (executable binary of some sort). Simply it takes your code and convert in executable format. While Transpiler software that converts the source code of one language into the source code of another.

End Note

Hope this blog have cleared your most of the doubts related to Compiler and Transpiler. I would like to get your feedback so that I can enhance more.
Thank You!