---
title: "Loop Controller"
description: "Configure the JMeter Loop Controller logic controllers: properties, defaults, and practical usage notes for building reliable load tests."
url: https://docs.jmeter.ai/components/loop-controller/
lastUpdated: 2026-10-01
source: docs.jmeter.ai
---

# Loop Controller

*Part of the **Logic Controllers** category. Also documented in context in the [full Component Reference](/user-manual/component-reference/#loop-controller).*

**TL;DR:** the Loop Controller repeats its children a fixed number of times (or forever) within a single thread iteration — the basic building block for “do this sequence N times” inside a larger test plan.

![Loop Controller](/images/screenshots/logic-controller/loop-controller.png)

If you add Generative or Logic Controllers to a Loop Controller, JMeter will
loop through them a certain number of times, in addition to the loop value you
specified for the Thread Group.  For example, if you add one HTTP Request to a
Loop Controller with a loop count of two, and configure the Thread Group loop
count to three, JMeter will send a total of `2 * 3 = 6` HTTP Requests.

> **Note**
> JMeter will expose the looping index as a variable named `__jm__&lt;Name of your element&gt;__idx`. So for
> example, if your Loop Controller is named LC, then you can access the looping index through `\${__jm__LC__idx}`.
> Index starts at 0

| Name | Required | Description |
| --- | --- | --- |
| Name | No | Descriptive name for this controller that is shown in the tree. |
| Loop Count | Yes, unless “Forever” is checked | The number of times the subelements of this controller will be iterated each time                 through a test run.                 The value `-1` is equivalent to checking the `Forever` toggle.                 **Special Case:** The Loop Controller embedded in the [Thread Group](/user-manual/test-plan/#thread_group)                 element behaves slightly different.  Unless set to forever, it stops the test after                 the given number of iterations have been done.                  :::note When using a function in this field, be aware it may be evaluated multiple times.                 Example using `[__Random](/functions/random/)` will evaluate it to a different value for each child samplers of Loop Controller and result into unwanted behaviour. ::: |

#### Looping Example

[Download](../demos/LoopTestPlan.jmx) this example (see Figure 4).
In this example, we created a Test Plan that sends a particular HTTP Request
only once and sends another HTTP Request five times.

![Figure 4 - Loop Controller Example](/images/screenshots/logic-controller/loop-example.png)

*Figure 4 - Loop Controller Example*

We configured the Thread Group for a single thread and a loop count value of
one. Instead of letting the Thread Group control the looping, we used a Loop
Controller.  You can see that we added one HTTP Request to the Thread Group and
another HTTP Request to a Loop Controller.  We configured the Loop Controller
with a loop count value of five.

JMeter will send the requests in the following order: Home Page, News Page,
News Page, News Page, News Page, and News Page.

> **Note**
> Note, the File Reporter
> is configured to store the results in a file named “`loop-test.dat`” in the current directory.

### Common gotchas

- **“Forever”** here means “forever within this thread’s iteration,” not “forever for the whole test” — the enclosing Thread Group’s loop count still governs the outer repetition.
- Nesting a Loop Controller inside another Loop Controller multiplies iterations (`outer × inner`) — a common source of accidentally-huge request counts when someone forgets an existing outer loop.
- For conditional repetition instead of a fixed count, use [While Controller](/components/while-controller/); for a single conditional branch, use [If Controller](/components/if-controller/).
- See [Logic Controllers & Flow Control](/topics/logic-controllers-flow-control/) for how loop, branch, and grouping controllers combine in a realistic test plan.

## Related

- [Logic Controllers & Flow Control](/topics/logic-controllers-flow-control/)
- [Full Component Reference](/user-manual/component-reference/)
- [Functions and Variables](/user-manual/functions/)
