Open-source deep learning

Keras — A Powerful Framework for Deep Learning

Keras is a free, open-source deep learning framework with an intuitive Python API for building, training and deploying neural networks. Keras 3 runs on JAX, TensorFlow and PyTorch, so you write a model once and run it on any backend — its clean, layer-based design makes building models fast to read, write and iterate.

Free & open source Apache 2.0 Python JAX · TensorFlow · PyTorch
3backends supported
~3Mdevelopers
Apache 2.0open-source license
Sequential modelmodel.summary()
INInput(784,)
DDense · 128relu
DRDropout0.2
DDense · 64relu
OUTDense · 10softmax
Epoch 7/10acc 0.98
Features

Everything you need to build neural networks

A high-level framework that keeps deep learning readable — without hiding the power underneath. Each capability below is built to save you time while leaving the lower levels open when you need them.

Layer-based API

Compose models from layers with the Sequential and Functional APIs — readable, intuitive and quick to build.

Multi-backend (Keras 3)

Run the same model on JAX, TensorFlow or PyTorch, and switch backends without rewriting your code.

Fast prototyping

A high-level, human-friendly API means less boilerplate and faster iteration from idea to trained model.

Full training workflow

Compile, fit, evaluate and predict — plus callbacks, metrics and checkpoints for real training loops.

Pretrained models

Reach for ready-made architectures and pretrained weights to transfer-learn instead of starting from zero.

Production-ready

Export trained models and deploy across the backend's ecosystem — servers, mobile and the browser.

Write once, run on any backend

Keras 3 is backend-agnostic — pick the framework that fits your project and switch any time, with no rewrite. It is the feature that future-proofs your code against framework lock-in.

JAXTensorFlowPyTorch
Get Keras

Install with pip, or download the source

Keras is a Python package, so there is no installer to run. You add it with pip and a backend of your choice, or grab the raw source for reading and contributing. The download button keeps you on this page and links to the official repository. Below, install the framework, then pick one of the three backends.

Install Keras

Install the framework, then install a backend of your choice. Keras itself is small; the backend is what pulls in the deep-learning engine and any GPU support.

$ pip install keras
$ pip install tensorflow # or jax / torch

Choose a backend

JAXTensorFlowPyTorch

Download the source

Get the complete Keras repository (master branch) as a zip, straight from the official GitHub — useful for reading the source, pinning a snapshot, or contributing a fix.

Download .zip
License
Apache 2.0 (free)
Language
Python 3.11+
Latest line
Keras 3.x
Source
keras-team/keras
How to use

The Keras model workflow

Five stages take you from a blank model to live predictions — the same flow on every backend. Once you learn this loop, almost every Keras project you ever build follows the same shape, which is a big part of why the framework is so approachable.

model = keras.Sequential

Define

Stack layers into a model with the Sequential or Functional API.

model.compile

Compile

Set the optimizer, loss function and metrics the model will train against.

model.fit

Fit

Train the model on your data for a number of epochs, with optional callbacks.

model.evaluate

Evaluate

Measure performance on held-out test data to check how well it generalizes.

model.predict

Predict

Run the trained model on new inputs to get predictions.

Overview

What Keras actually does

Keras is the high-level layer where you design and train neural networks. Instead of wiring up tensors and gradients by hand, you stack layers, pick an optimizer and loss, and call a few methods. Underneath, Keras 3 hands the heavy numerical work to a backend — JAX, TensorFlow or PyTorch — so you get both a friendly API and serious performance. In practice that means you can read a Keras script and understand the model at a glance: the layers, the shapes, the loss and the optimizer are all right there, named plainly, instead of being buried in low-level tensor operations.

The design goal has always been to lower the cognitive load of deep learning. Sensible defaults, consistent naming and clear error messages mean you spend your time on the model and the data, not on boilerplate. You can start with the Sequential API for simple stacks of layers, move to the Functional API for models with multiple inputs or branches, and subclass Model when you need full control — all within the same framework, so your knowledge carries over as your needs grow.

It is used by students learning deep learning, researchers prototyping new ideas, and engineers shipping models to production. Typical projects include image classifiers, text and language models, recommender systems and forecasting. Read more about this site or the guide on what Keras is.

import keras
from keras import layers

model = keras.Sequential([
    layers.Dense(128, activation="relu"),
    layers.Dropout(0.2),
    layers.Dense(10, activation="softmax"),
])

model.compile(optimizer="adam",
    loss="categorical_crossentropy",
    metrics=["accuracy"])

model.fit(x_train, y_train, epochs=10)
  • 1. Install Keraspip install keras
  • 2. Install a backendtensorflow, jax or torch
  • 3. Pick the backendset KERAS_BACKEND before importing
  • 4. Build & traindefine → compile → fit
Setup

Installation and first use

There is no installer to run — Keras is a Python package. In a clean environment, pip install keras, then install one backend: tensorflow, jax or torch. Keras 3 needs Python 3.11 or newer.

Before your first import keras, choose the backend by setting the KERAS_BACKEND environment variable — it can't be changed after import. From there the workflow is the same everywhere: define a model, compile it, and call fit(). For the exact, current commands and GPU setup, follow the official getting-started guide. Keras never asks you to disable any security setting.

A practical tip: keep a separate virtual environment for each backend. JAX, TensorFlow and PyTorch each pull in their own CUDA and dependency versions, and mixing them in one environment is the most common cause of install headaches. A clean environment per backend keeps things reproducible and easy to debug.

Compatibility

Compatibility & requirements

Keras runs on Python with your chosen backend, so its requirements are really Python plus that backend's requirements. The table lists the minimums for the current Keras 3 line. A website's browser support is a separate question from the framework's own runtime needs.

RequirementMinimumStatusNotes
Python3.11 or newerSupportedRequired by recent Keras 3 releases
JAX backendJAX 0.4.20+SupportedOften the fastest option
TensorFlow backendTensorFlow 2.16.1+SupportedDrop-in for tf.keras
PyTorch backendPyTorch 2.1.0+SupportedUse Keras on top of Torch
GPU / TPUCUDA via backendVia backendInstall the backend's GPU build
Operating systemLinux, macOS, WindowsSupportedWindows via WSL2 recommended

Minimum backend versions follow the official Keras 3 guidance and may change with new releases.

Balance

Pros and cons

An honest look at where Keras fits and where it doesn't, so you can decide whether it's the right level of abstraction for your project before you commit to it.

Advantages

  • Free and open source (Apache 2.0)
  • Clean, readable high-level API — fast to learn
  • Multi-backend: JAX, TensorFlow or PyTorch
  • Full training workflow with callbacks and metrics
  • Great for prototyping and production alike

Limitations

  • It's a framework, not a no-code tool
  • You still install and manage a backend
  • Very low-level control may need native backend code
  • Large models need real GPU/TPU hardware
  • Keras 2 (tf-keras) vs Keras 3 can confuse newcomers
Comparison

Keras vs. PyTorch, TensorFlow and JAX

How Keras relates to the frameworks people compare it with — several of which it can run on. The honest framing isn't "Keras versus the rest" so much as "Keras on top of the rest," which changes how you should read the table below.

CriteriaKerasPyTorchTensorFlowJAX
LevelHigh-level APILow-level frameworkLow-level frameworkNumerical / array library
LanguagePythonPythonPythonPython
Best forFast, readable modellingResearch & fine controlFull platform & deploymentHigh-performance computing
Learning curveGentleModerateSteeperSteeper
Works with Keras 3— (it is Keras)Yes (backend)Yes (backend)Yes (backend)

The key thing to understand is that Keras isn't strictly a rival to PyTorch, TensorFlow or JAX — since Keras 3, it runs on top of them. You can keep Keras's friendly API and still tap the speed of JAX, the deployment ecosystem of TensorFlow, or the flexibility of PyTorch. Choose raw PyTorch or JAX when you need the lowest-level control; choose Keras when you want to move fast without giving up those engines underneath.

This is also why the old "Keras or PyTorch?" and "Keras or TensorFlow?" debates have softened. For a beginner, Keras is usually the gentler on-ramp; for cutting-edge research that bends the framework in unusual ways, native PyTorch or JAX can be more direct. But because Keras 3 sits on top of all three, many teams no longer treat it as a mutually exclusive choice — they adopt Keras for everyday modelling and drop to the backend only for the rare parts that genuinely need it.

Troubleshooting

Troubleshooting & best practices

The snags people hit most, with quick fixes. Most Keras problems trace back to the backend or the environment rather than your model code, so that's the first place to look. For version-specific issues, check the official release notes.

Issue

"No backend" or import errors

Cause: Keras is installed but no backend is.
Fix: Install one backend — pip install tensorflow, jax or torch — then retry.

Issue

Backend didn't change

Cause: KERAS_BACKEND was set after importing Keras.
Fix: Set KERAS_BACKEND (or edit ~/.keras/keras.json) before the first import keras.

Issue

GPU not detected

Cause: A CPU-only backend build is installed.
Fix: Install the backend's CUDA/GPU build and confirm your NVIDIA driver and CUDA versions match.

Issue

Old tf.keras code behaves differently

Cause: You're mixing Keras 2 and Keras 3 APIs.
Fix: Keras 3 is a drop-in for tf.keras; save models in the .keras format, or pin tf-keras for legacy code.

Issue

Shape or dtype mismatch

Cause: Input shape doesn't match the first layer.
Fix: Check model.summary() and your data shapes; set the input shape explicitly if needed.

Best practice: work in a clean virtual environment per backend, pin your Keras and backend versions, and save models in the modern .keras format for portability.
Perspectives

What people build with Keras

No invented reviews or ratings — just the kinds of real projects Keras is built for. The same framework spans very different problem areas, which is why it turns up everywhere from first tutorials to production systems.

Computer vision

Image models

Build and train classifiers, detectors and segmentation models on image data with convolutional and modern architectures.

NLP & language

Text models

Tokenize and model text for classification, sentiment, translation and sequence tasks — from RNNs to transformers.

Forecasting & more

Time-series & tabular

Model sequences and structured data for forecasting, recommendation and anomaly detection.

FAQ

Frequently asked questions

Licensing, backends, TensorFlow and PyTorch, Python versions and more.

Is Keras free?

Yes. Keras is free and open source under the Apache 2.0 license, which permits personal and commercial use. You install it with pip install keras or get the source from GitHub.

Is Keras open source?

Yes. Keras is developed in the open on GitHub by the Keras team and community contributors under the Apache 2.0 license, so you can read, modify and redistribute it.

What is Keras used for?

Keras is used to build and train neural networks for deep learning — computer vision, natural language processing, audio, time-series forecasting, recommender systems and more — with a clean, high-level Python API.

What is the difference between Keras and TensorFlow?

TensorFlow is a full numerical/ML platform; Keras is a high-level API for building models. Keras 3 is multi-backend — it can run on TensorFlow, JAX or PyTorch — so Keras is the friendly modelling layer and TensorFlow is one of the engines it can run on.

Does Keras support PyTorch and JAX?

Yes. Keras 3 is a multi-backend framework with support for JAX, TensorFlow and PyTorch (plus OpenVINO for inference). You write the model once and choose the backend.

Which Python version does Keras need?

Recent Keras 3 releases require Python 3.11 or newer. You also install a backend package (tensorflow, jax, or torch).

Is Keras still used?

Yes — widely. Keras reports a community of nearly three million developers, and Keras 3's multi-backend design has broadened where it runs. See our guide on whether people still use Keras.

How do I choose a backend?

Set the KERAS_BACKEND environment variable (to jax, tensorflow or torch) before importing Keras. The backend can't be changed after import.

Is Keras 2 still available?

Yes. Keras 2 remains available as the tf-keras package. Keras 3 is designed as a drop-in replacement for tf.keras when using the TensorFlow backend.

Does this website host Keras?

No. This is an independent information site. The download button links to the official Keras GitHub repository and is set up so you stay on this page while the download begins.

Get started

Build your first neural network with Keras

Free, open source and multi-backend. Install it with pip, or download the source — the button keeps you on this page and links to the official GitHub repository. Whether you're writing your first classifier or shipping a model to production, the workflow is the same five steps — and the guides walk you through each of them.