---
title: "User Defined Variables"
description: "Configure the JMeter User Defined Variables configuration elements: properties, defaults, and practical usage notes for building reliable load tests."
url: https://docs.jmeter.ai/components/user-defined-variables/
lastUpdated: 2026-10-01
source: docs.jmeter.ai
---

# User Defined Variables

*Part of the **Configuration Elements** category. Also documented in context in the [full Component Reference](/user-manual/component-reference/#user-defined-variables).*

![User Defined Variables](/images/screenshots/user_defined_variables.png)

The User Defined Variables element lets you define an **initial set of variables**, just as in the [Test Plan](/components/test-plan/).

> **Note**
> Note that all the UDV elements in a test plan - no matter where they are - are processed at the start.

So you cannot reference variables which are defined as part of a test run, e.g. in a Post-Processor.

**UDVs should not be used with functions that generate different results each time they are called.
Only the result of the first function call will be saved in the variable.**
However, UDVs can be used with functions such as `[__P()](/functions/p/)`, for example:

```plaintext
HOST      \${__P(host,localhost)}
```

which would define the variable “`HOST`” to have the value of the JMeter property “`host`”, defaulting to “`localhost`” if not defined.

For defining variables during a test run, see [User Parameters](/components/user-parameters/).
UDVs are processed in the order they appear in the Plan, from top to bottom.

For simplicity, it is suggested that UDVs are placed only at the start of a Thread Group
(or perhaps under the Test Plan itself).

Once the Test Plan and all UDVs have been processed, the resulting set of variables is
copied to each thread to provide the initial set of variables.

If a runtime element such as a User Parameters Pre-Processor or Regular Expression Extractor defines a variable
with the same name as one of the UDV variables, then this will replace the initial value, and all other test
elements in the thread will see the updated value.

> **Note**
> If you have more than one Thread Group, make sure you use different names for different values, as UDVs are shared between Thread Groups.
> Also, the variables are not available for use until after the element has been processed,
> so you cannot reference variables that are defined in the same element.
> You can reference variables defined in earlier UDVs or on the Test Plan.

| Name | Required | Description |
| --- | --- | --- |
| Name | No | Descriptive name for this element that is shown in the tree. |
| User Defined Variables | No | Variable name/value pairs. The string under the “`Name`”       column is what you’ll need to place inside the brackets in `\${…}` constructs to use the variables later on. The       whole `\${…}` will then be replaced by the string in the “`Value`” column. |

## Related

- [CSV Data Set & Parameterization](/topics/csv-data-set-config-guide/)
- [Thread Calculator](/tools/thread-calculator/)
- [Full Component Reference](/user-manual/component-reference/)
- [Functions and Variables](/user-manual/functions/)
