Babel is a compiler. At a high level, it has 3 stages that it runs code in: parsing, transforming, and generation (like many other compilers).

For an awesome/simple tutorial on compilers, check out the-super-tiny-compiler, which also explains how Babel itself works on a high level.

Now, out of the box Babel doesn’t do anything. It basically acts like const babel = code => code; by parsing the code and then generating the same code back out again.

You will need to add some plugins for Babel to do anything (they affect the 2nd stage, transformation).

Don’t know where to start? Check out some of our presets.


Don’t want to assemble your own set of plugins? No problem! Presets are sharable .babelrc configs or simply an array of babel plugins.

Official Presets

We’ve assembled some for common environments:

Each yearly preset only compiles what was ratified in that year. Use preset-latest to transform all yearly presets

Many other community maintained presets are available on npm!

Stage-X (Experimental Presets)

Any transforms in stage-x presets are changes to the language that haven’t been approved to be part of a release of Javascript (such as ES6/ES2015).

“Changes to the language are developed by way of a process which provides guidelines for evolving an addition from an idea to a fully specified feature”

Subject to change

These proposals are subject to change so use with extreme caution, especially for anything pre stage-3. We plan to update stage-x presets when proposals change after each TC39 meeting when possible.

The TC39 categorises proposals into 4 stages:

  • stage-0 - Strawman: just an idea, possible Babel plugin.
  • stage-1 - Proposal: this is worth working on.
  • stage-2 - Draft: initial spec.
  • stage-3 - Candidate: complete spec and initial browser implementations.
  • stage-4 - Finished: will be added to the next yearly release.

Also check out the current TC39 proposals and its process document.

Transform Plugins

These plugins apply transformations to your code.

Transform plugins will enable the corresponding syntax plugin so you don't have to specify both.









Check out our minifier based on Babel!

These plugins are in the minify repo.



Misc Plugins

Syntax Plugins

These plugins allow Babel to parse specific types of syntax (not transform).

NOTE: Transform plugins automatically inherit/use the syntax plugins so you don’t need to specify the syntax plugin if the corresponding transform plugin is used already.

You can also provide any plugins option from babylon:

// .babelrc
  "parserOpts": {
    "plugins": ["jsx", "flow"]


Enabled by default

These plugins have no effect anymore, as a newer babylon version enabled them by default


Plugin/Preset Paths

If the plugin is on npm, you can pass in the name of the plugin and babel will check that it’s installed in node_modules

"plugins": ["babel-plugin-myPlugin"]

You can also specify an relative/absolute path to your plugin/preset.

"plugins": ["./node_modules/asdf/plugin"]

Preset/Plugin Shorthand

If you prefix the plugin with babel-plugin-, you can use a shorthand to leave out that prefix

"plugins": ["myPlugin"]

Same with presets

"presets": ["babel-preset-myPreset"]


"presets": ["myPreset"]

This also works with scoped packages

  presets: ["@org/babel-preset-name"], // actual package
  presets: ["@org/name"] // shorthand name

Plugin/Preset Ordering

Ordering matters for each visitor in the plugin. This means if two transforms both visit “Program”, the transforms will run in either plugin or preset order.

Plugins run before Presets.

Plugin ordering is first to last.

"plugins": [
  "transform-decorators-legacy", // will run first
  "transform-class-properties" // will run second

Preset ordering is reversed (last to first).

Yes this is confusing, see babel/notes #2.

I believe the reason why (for backwards compatability) is that most users had listed “es2015” first and “stage-0” second. And stage-0 would run before es2015.

"presets": [
  "es2015", // will run third
  "react", // will run second
  "stage-2" // will run first

Plugin/Presets Options

Plugins and Presets can both specify options. You can do so in your config by wrapping it in an array and providing a options object. For example:

  "plugins": [
    ["transform-async-to-module-method", {
      "module": "bluebird",
      "method": "coroutine"

  "presets": [
    ["es2015", { "loose": true, "modules": false }]

Plugin Development

Please refer to the excellent babel-handbook to learn how to create your own plugins.

The simple plugin that reverses names (from the homepage):

export default function ({types: t}) {
  return {
    visitor: {
      Identifier(path) {
        let name =;
        // reverse the name: JavaScript -> tpircSavaJ = name.split('').reverse().join('');

Creating a Preset

To make your own preset, you just need to export a config.

// Presets can contain other presets, and plugins with options.
module.exports = {
  presets: [
  plugins: [
    [require('babel-plugin-transform-es2015-template-literals'), { spec: true }],

For more info, check out the babel handbook section on presets or just look at the es2015 preset repo as an example.