# $field->toFloat()

Converts the field value into a proper float

****

- Source: <https://github.com/getkirby/kirby/tree/5.5.3/config/methods.php#L179>

****

```php
$field->toFloat(float $default = 0.0): float
```

## Parameters

| Name | Type | Default | Description |
| ---- | ---- | ---- | ---- |
| `$default` | `float` | `0.0` | Default value if the field is empty |

## Return type

`float`

This method modifies the existing `$field` object it is applied to and returns it again.

## Aliases

You can use the following aliases for this field method in your template:

- `$field->float(…)`

## Examples

```php
<?= $page->mynumber()->toFloat() ?>
```