# Bad value “” for attribute “min” on element “input”: The empty string is not a valid floating point number.

> Canonical HTML version: https://rocketvalidator.com/html-validation/bad-value-for-attribute-min-on-element-input-the-empty-string-is-not-a-valid-floating-point-number
> Attribution: Rocket Validator (https://rocketvalidator.com)
> License: CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/)

The `min` attribute defines the minimum acceptable value for form input types such as `number`, `range`, `date`, `time`, `datetime-local`, `week`, and `month`. When the browser or the W3C validator encounters `min=""`, it attempts to parse the empty string as a floating point number and fails because the empty string is not a valid representation of any number according to the [HTML specification's rules for parsing floating point numbers](https://html.spec.whatwg.org/multipage/common-microsyntaxes.html#valid-floating-point-number).

This issue commonly arises when templating engines or server-side code dynamically set the `min` attribute but output an empty value when no minimum is configured, or when developers add the attribute as a placeholder intending to fill it in later.

## Why this matters

- **Standards compliance:** The HTML specification explicitly requires the `min` attribute's value to be a valid floating point number (for numeric types) or a valid date/time string (for date/time types). An empty string satisfies neither requirement.
- **Unpredictable browser behavior:** When browsers encounter an invalid `min` value, they typically ignore the attribute entirely. This means your intended constraint silently disappears, potentially allowing users to submit out-of-range values.
- **Accessibility concerns:** Assistive technologies may rely on `min` and `max` to communicate valid input ranges to users. An invalid value can lead to confusing or missing guidance for screen reader users.
- **Form validation issues:** Built-in browser validation using the Constraint Validation API depends on valid `min` values. An empty string can cause the browser's native validation to behave inconsistently across different browsers.

## How to fix it

You have two straightforward options:

1. **Provide a valid value:** Set `min` to the actual minimum number or date/time string you want to enforce.
2. **Remove the attribute:** If no minimum constraint is needed, simply omit the `min` attribute. The input will then accept any value within its type's natural range.

If your `min` value comes from dynamic server-side or JavaScript logic, make sure the attribute is only rendered when a valid value is available, rather than outputting an empty string as a fallback.

## Examples

### ❌ Invalid: empty string for `min`

```html
<input type="number" min="" max="10">
```

The empty string `""` is not a valid floating point number, so this triggers the validation error.

### ✅ Fixed: provide a valid number

```html
<input type="number" min="0" max="10">
```

### ✅ Fixed: remove `min` if no minimum is needed

```html
<input type="number" max="10">
```

### ❌ Invalid: empty `min` on a range input

```html
<input type="range" min="" max="100" step="5">
```

### ✅ Fixed: valid `min` on a range input

```html
<input type="range" min="0" max="100" step="5">
```

### ❌ Invalid: empty `min` on a date input

```html
<input type="date" min="" max="2025-12-31">
```

For date inputs, `min` must be a valid date string in `YYYY-MM-DD` format — an empty string is equally invalid here.

### ✅ Fixed: valid `min` on a date input

```html
<input type="date" min="2025-01-01" max="2025-12-31">
```

### Handling dynamic values in templates

If you're using a templating language and the minimum value might not always exist, conditionally render the attribute rather than outputting an empty value. For example, in a generic template pseudocode:

```html
<!-- Instead of always outputting the attribute: -->
<input type="number" min="" max="10">

<!-- Only include it when a value is available: -->
<input type="number" min="5" max="10">
```

In practice, use your templating engine's conditional logic (e.g., `{% if min_value %}min="{{ min_value }}"{% endif %}` in Jinja2, or similar constructs) to ensure `min` is only present when it holds a valid value.
