---
title: "How to test serverless functions locally | Netlify"
description: "Realize the speed, agility and performance of a scalable, composable web architecture with Netlify. Explore the composable web platform now!"
source: "https://www.netlify.com/blog/2021/12/12/how-to-test-serverless-functions-locally/"
last_updated: "2026-07-10T20:31:08.000Z"
---
> Throughout December we’ll be [highlighting a different Netlify feature each day](https://www.netlify.com/blog/2021/12/01/highlighting-a-different-netlify-feature-each-day-in-december/?utm_campaign=featdaily21&utm_source=netlify&utm_medium=blog&utm_content=dev-functions). It might just be the thing you need to unlock those creative juices, and [dust off that domain](https://www.netlify.com/blog/2021/12/01/dusty-domains-your-forgotten-domains-raise-money-for-charity/?utm_campaign=featdaily21&utm_source=netlify&utm_medium=blog&utm_content=dev-functions) you registered but never deployed! Keep an eye [on the blog](https://www.netlify.com/blog/2021/12/01/highlighting-a-different-netlify-feature-each-day-in-december/?utm_campaign=featdaily21&utm_source=netlify&utm_medium=blog&utm_content=dev-functions) and on [Twitter](https://twitter.com/netlify) for each feature!

Yesterday we saw that you could [deploy serverless functions by adding your JavaScript, TypeScript or Go files to a specified folder](/blog/2021/12/11/serverless-functions-made-simple-just-add-files/?utm_campaign=featdaily21&utm_source=netlify&utm_medium=blog&utm_content=dev-functions) in your project. But how do you develop and test your functions locally so that you can validate that they work correctly before deploying them?

[Netlify CLI](https://www.netlify.com/platform/core/cli/?utm_campaign=featdaily21&utm_source=netlify&utm_medium=blog&utm_content=dev-functions) has the answer in the form of Netlify Dev.

One of the advantages of using Netlify Dev (which comes bundled as part of Netlify CLI), is that it will detect the serverless functions in your project, and automatically serve them for you in a local development server so that they behave just the same as when they are deployed to Netlify.

Simply run `netlify dev` in your project directory. Your functions will have access to your project’s environment variables and be served on the same port as the rest of your web project.

> Tip: Install Netlify CLI first by running `npm install -g netlify-cli`

## But there’s more!

Netlify CLI can also help you with other tasks related to building serverless functions including testing invocations and creating new functions from a set of boilerplate examples in JavaScript, TypeScript and Go.

Try running `netlify functions:create` in your project folder and following the prompts.

You can also explore the functions command in Netlify CL by running `netlify help functions`

```
# netlify help functions
COMMANDS  functions:build   Build functions locally  functions:create  Create a new function locally  functions:invoke  Trigger a function while in netlify dev with simulated data, good for testing function calls including Netlify's Event Triggered Functions  functions:list    List functions that exist locally  functions:serve   (Beta) Serve functions locally
```

## More information

-   [Netlify CLI and Netlify Dev](https://www.netlify.com/platform/core/cli/?utm_campaign=featdaily21&utm_source=netlify&utm_medium=blog&utm_content=dev-functions)
-   [About Netlify Functions](https://www.netlify.com/platform/core/functions/?utm_campaign=featdaily21&utm_source=netlify&utm_medium=blog&utm_content=dev-functions)
-   [Netlify Functions made simple - Just add files](/blog/2021/12/11/serverless-functions-made-simple-just-add-files/?utm_campaign=featdaily21&utm_source=netlify&utm_medium=blog&utm_content=dev-functions)

### Share

-   [X (fka Twitter)](https://twitter.com/intent/tweet?text=How to test serverless functions locally&url=https://www.netlify.com/blog/2021/12/12/how-to-test-serverless-functions-locally/)
-   [LinkedIn](https://www.linkedin.com/shareArticle?mini=true&url=https%3A%2F%2Fwww.netlify.com%2Fblog%2F2021%2F12%2F12%2Fhow-to-test-serverless-functions-locally%2F)
-   [Facebook](https://www.facebook.com/sharer.php?u=https://www.netlify.com/blog/2021/12/12/how-to-test-serverless-functions-locally/)
-   [Bluesky](https://bsky.app/intent/compose?text=How to test serverless functions locally+https://www.netlify.com/blog/2021/12/12/how-to-test-serverless-functions-locally/)

* * *

### Tags

-   [Tips](/blog/tags/tips/)
-   [CLI](/blog/tags/cli/)
-   [Serverless](/blog/tags/serverless/)
-   [Functions](/blog/tags/functions/)
-   [Netlify Dev](/blog/tags/Netlify-Dev/)

## Keep reading

![](/images/blog-fallback-thumbnail.svg)

Guides & Tutorials December 11, 2021

[

### Serverless functions made simple - Just add files

](/blog/2021/12/11/serverless-functions-made-simple-just-add-files/)

-   ![Profile picture of Phil Hawksworth](/_astro/9cfe2bbe94bcb555ce3ac7683ac7905ad3fd32b1-400x400_Z18H6R1.webp)
    
    Phil Hawksworth
    

![](/images/blog-fallback-thumbnail.svg)

Tools & Services February 18, 2021

[

### Netlify Functions - for an unrivaled serverless workflow

](/blog/2021/02/18/netlify-functions-for-an-unrivaled-serverless-workflow/)

-   ![Profile picture of Phil Hawksworth](/_astro/9cfe2bbe94bcb555ce3ac7683ac7905ad3fd32b1-400x400_Z18H6R1.webp)
    
    Phil Hawksworth
    

## Recent posts

News & Announcements June 25, 2026

[

### Netlify Functions, designed for Agent Experience

](/blog/netlify-functions-designed-for-agent-experience)

-   ![Profile picture of Eduardo Bouças](/_astro/52958f21e8450baf6d8e60302341a984e220c0cd-512x512_13VDlu.webp)
    
    Eduardo Bouças
    

News & Announcements June 24, 2026

[

### How we measure Netlify’s Agent Experience

](/blog/how-we-measure-netlify-agent-experience)

-   ![Profile picture of Sean Roberts](/_astro/bbf2243f8171dbddd80ab2103622106cef84d125-512x512_Z1d2LKE.webp)
    
    Sean Roberts
    

Guides & Tutorials May 15, 2026

[

### How to build a real-time AI chatbot in minutes with Netlify Agent Runners (no backend)

](/blog/how-to-build-a-real-time-ai-chatbot-in-minutes-with-netlify-agent-runners-no-backend)

-   ![Profile picture of Nahrin Jalal](/_astro/f0e7c8f227a03fe58340c99ef5439d5a896c0733-272x272_Z23kDpD.webp)
    
    Nahrin Jalal
    

![](/_astro/3f255b372fa958df35802666ee33b4609b2d71bd-1200x1586_1VtE2D.webp)

### How do the best dev and marketing teams work together?

[Access the report](https://www.netlify.com/reports/2024-leadership-trend-report/access/)