***

title: The Create Variable block
approved: 2025-07-07T00:00:00.000Z
topictype: reference
slug: docs/postman-flows/reference/blocks/create-variable
max-toc-depth: 2
ux: v12
-------

The **Create Variable** block creates a variable and assigns it a name and a value. The variable can then be referenced by one or more [**Get Variable**](/docs/postman-flows/reference/blocks/get-variable/) blocks from anywhere in the flow. The variable's value comes from the block that's connected to the **Create Variable** block's input port. For example, you could connect a **String** block's output port to the **Create Variable** block's input port. Whatever text you enter in the **String** block will be assigned to the variable named in the **Create Variable** block. Or you could connect an **HTTP Request** block to a **Create Variable** block to assign the request's entire response to the variable.

**Create Variable** blocks are colored by default. Any **Get Variable** blocks that reference the variable also has the same color. When you click a **Create Variable** block that's referenced by a **Get Variable** block, a dotted line appears between them. The dotted line is the same color as the blocks. This can be useful when you're locating variables in your flow.

## Input

**Variable (number)** - Accepts any data sent from a single connected block, including:

* Text
* A number
* A JSON object
* A boolean value
* A list
* An image

## Setup

Click the variable's name in the block to edit it. To change the block's color, click the block, then click <img alt="Style icon" src="https://assets.postman.com/postman-docs/aether-icons/action-style-stroke.svg#icon" width="16px" /> **Change Color** and select a new color. Any **Get Variable** blocks that reference the variable will update their name or color automatically.

## Example

To see the **Create Variable** block in an example flow, check out [Flow Snippets: Variables](https://www.postman.com/postman/flows-snippets/flow/63bc94d282cf9728f279e020).

## Related blocks

* [**Get Variable**](/docs/postman-flows/reference/blocks/get-variable/)

## Related pages

For tutorials that use the **Create Variable** block, see the following:

* [Automate repetitive tasks using Postman Flows](/docs/postman-flows/tutorials/advanced/automate-repetitive-tasks/)
* [Calculate the years since a milestone](/docs/postman-flows/tutorials/beginner/calculate-years-since-milestone/)
