---
title: Table
summary: null
url: https://www.fastly.com/documentation/reference/vcl/declarations/table
---

A `table` declaration creates a key-value store in VCL code. Table keys are always of type `STRING`, and values may be one of a number of VCL types, but must all be of the same type within the same table.

Tables may be declared using VCL, but can also be created via an [API call](https://www.fastly.com/documentation/reference/api/dictionaries/dictionary/#create-dictionary), using the CLI, or using the [web interface](https://www.fastly.com/documentation/guides/full-site-delivery/dictionaries/working-with-dictionaries).

> **HINT:** Tables created via API, CLI, or web interface are called [dictionaries](https://www.fastly.com/documentation/guides/concepts/edge-state/dynamic-config/#dictionaries) and are dynamic (i.e., the items in the dictionary may be changed without cloning and activating a new version of your service).

## Syntax

The following examples shows the syntax of a `STRING` table:

```vcl
table redirects {
  "/old/path": "https://other.hostname/new/path",
  "/another/path": "/new/path",
}
```

The `table.contains` function will return a `BOOL` indicating whether a specified key is in the table.

For `STRING` tables, the `table.lookup` function returns the value for a specified key, or a fallback value if the key is not present in the table.

Either short- or long-form strings are supported for keys and for values
using [STRING literals](https://www.fastly.com/documentation/reference/vcl/types/string).

A trailing comma after the final value is optional, but supported.

## Type variations

Table declarations support a type specifier and valid types are `STRING` (the default), `ACL`, `BACKEND`, `BOOL`, `FLOAT`, `INTEGER`, `IP`, `REGEX`, and `RTIME`. All values within the same table are of the same type.

A typed table is declared like this:

```vcl
table routing_table BACKEND {
  "a.example.com": b0,
  "b.example.com": b1,
  "c.example.com": b2,
}
```

The syntax for values differs for each type.

The optional [type](https://www.fastly.com/documentation/reference/vcl/types) for values,
defaults to STRING when not specified.

The following functions return values from typed tables:

- `table.lookup_acl`
- `table.lookup_backend`
- `table.lookup_bool`
- `table.lookup_float`
- `table.lookup_integer`
- `table.lookup_ip`
- `table.lookup_regex`
- `table.lookup_rtime`

## Usage

Redirects are a very common use case for tables:

[Try it in Fastly Fiddle](https://fiddle.fastly.dev/95954fd2)

## Limitations

The number of items in a single table is limited to 1000 by default, but larger tables are common. If you need a larger limit than the default, get in touch with [Fastly support](https://support.fastly.com/) and we'll be glad to assist you.
