### [How to Count Checkbox Selections Inside Your Form](https://wpforms.com/developers/how-to-count-checkbox-selections-inside-your-form/)

**Published:** June 2, 2021
**Author:** Editorial Team

**Excerpt:** This tutorial will walk you through how to keep a dynamic count of checkbox selections inside your form. 

**Content:**

## Introduction

Would you like to count checkbox selections inside your form? With a small snippet, you can have your form automatically display a count of the selections that increase and decreases as each selection is made. In this tutorial, we’re going to walk you through each step on how to achieve this.

## Creating the form

First, you’ll need to create a new form and add your **Checkbox** field to the form. If you need help in creating your form, [please review this documentation](https://wpforms.com/docs/creating-first-form/ "Creating Your First Form").

![begin by creating your form, adding your fields which include at least one checkbox field](https://wpforms.com/wp-content/uploads/2022/06/wpforms-creating-form-count-selections.jpg)

## Adding a field to hold your count of the checkbox selections

Now we’re going to add a field to your form that will contain the count as the selections are made.

We’re going to add a **Single Line Text** form field that will hold the count in your form.

![add a single line text field to your form to hold the count of the checkbox selections](https://wpforms.com/wp-content/uploads/2022/06/wpforms-count-container.jpg)

## Adding the snippet to your site

Now it’s time to add the snippet to your site that will update the count as the selections are checked and unchecked.

If you need any help on adding snippets to your site, [please take a look at this tutorial](https://wpforms.com/developers/how-to-add-custom-php-or-javascript-for-wpforms/ "How to Add Custom PHP or JavaScript for WPForms").

```

/*
 * Count checkbox selections
 *
 * @link  https://wpforms.com/developers/how-to-count-checkbox-selections-inside-your-form/
 */

function wpf_dev_checkbox_count() {
    ?>

**Categories:** Tutorials

**Tags:** Javascript, JS

---

