# Wavelength & Frequency Calculator

> Converts between wavelength and frequency for a wave of known propagation speed (default: the speed of light in vacuum) and, for electromagnetic waves in vacuum, reports the photon energy E = h·f in joules and electronvolts.

- Calculator id: `wavelength-frequency` · Category: Physics (`physics`) · Tool name: `convert_wavelength_frequency`
- Canonical page: https://tttkmbb.com/physics/wavelength-frequency · This document: https://tttkmbb.com/physics/wavelength-frequency.md · JSON definition: https://tttkmbb.com/physics/wavelength-frequency.json

## Purpose

Converts between wavelength and frequency for a wave of known propagation speed (default: the speed of light in vacuum) and, for electromagnetic waves in vacuum, reports the photon energy E = h·f in joules and electronvolts.

**Use when:** You know either the wavelength or the frequency of a light, radio or sound wave and need the other, or you need the photon energy of light of a given wavelength.

**Do not use when:** The wave travels in a dispersive medium (glass, water) unless you supply the correct phase speed, or you need Doppler shifts or refraction.

## Input

| Parameter | Type | Unit | Required | Description |
| --- | --- | --- | --- | --- |
| `wavelength_m` | number | m | optional | Wavelength in metres (1 nm = 1e-9 m, so 500 nm = 5e-7). Give either wavelength_m or frequency_hz. (> 0) |
| `frequency_hz` | number | Hz | optional | Frequency in hertz (1 MHz = 1e6 Hz, 1 GHz = 1e9 Hz). Give either wavelength_m or frequency_hz. (> 0) |
| `wave_speed_m_s` | number | m/s | optional, default 299792458 | Propagation speed in the medium. Default c = 299,792,458 m/s (light in vacuum); use about 343 for sound in air at 20 °C, 1480 for sound in water. (> 0, max 299792458) |

## Output

| Field | Type | Unit | Description |
| --- | --- | --- | --- |
| `solved_for` | string |  | Which quantity was computed: wavelength_m or frequency_hz. |
| `wavelength_m` | number | m | λ = v / f. |
| `wavelength_nm` | number | nm | Wavelength in nanometres (visible light ≈ 380–750 nm). |
| `frequency_hz` | number | Hz | f = v / λ. |
| `wave_speed_m_s` | number | m/s | Propagation speed used. |
| `photon_energy_ev` | number | eV | E = h × f in electronvolts (only for electromagnetic waves in vacuum, i.e. wave_speed_m_s = c). |
| `photon_energy_j` | string | J | Photon energy in joules as a scientific-notation string with 5 significant figures, e.g. "3.9729e-19" (only when wave_speed_m_s = c). |

## Formula

`wavelength_m = wave_speed_m_s / frequency_hz; frequency_hz = wave_speed_m_s / wavelength_m; photon_energy_j = h × frequency_hz with h = 6.62607015e-34 J·s; photon_energy_ev = photon_energy_j / 1.602176634e-19`

## Data Sources

- Wikipedia – Wavelength — https://en.wikipedia.org/wiki/Wavelength (reference, retrieved 2026-09-23)
- Wikipedia – Photon energy — https://en.wikipedia.org/wiki/Photon_energy (reference, retrieved 2026-09-23)
- NIST CODATA 2018 – Fundamental Physical Constants — https://physics.nist.gov/cuu/Constants/ (standard, retrieved 2026-09-23)

Data freshness: `static`. Deterministic formula with fixed constants; results never go stale. Inputs supplied by the caller determine the output.

## API

- `GET https://tttkmbb.com/api/v1/calculate/wavelength-frequency?`
- `POST https://tttkmbb.com/api/v1/calculate/wavelength-frequency` with JSON body `{"inputs": {…}}`
- Response: unified envelope (`success`, `request`, `result.values`, `result.units`, `sources`, `freshness`, `timestamp`, `next_actions`, `links`); see https://tttkmbb.com/docs/response-format.md
- Schema: https://tttkmbb.com/api/v1/calculators/wavelength-frequency · OpenAPI operationId `convert_wavelength_frequency` in https://tttkmbb.com/openapi.json
- Authentication: none. Rate limit: fair use, see https://tttkmbb.com/docs/rate-limits.md.

## MCP

- Server: `https://tttkmbb.com/mcp` (Streamable HTTP, JSON-RPC 2.0, no auth)
- Tool:  `run_calculator` with `{"calculator_id": "wavelength-frequency", "inputs": {…}}`

## Example

- Green light, 500 nm in vacuum: inputs `{"wavelength_m":5e-7}` → `{"solved_for":"frequency_hz","frequency_hz":599584916000000,"wavelength_nm":500,"photon_energy_ev":2.479684,"photon_energy_j":"3.9729e-19"}`
- 440 Hz sound in air (343 m/s): inputs `{"frequency_hz":440,"wave_speed_m_s":343}` → `{"solved_for":"wavelength_m","wavelength_m":0.779545,"wavelength_nm":779545454.5455}`

```
GET https://tttkmbb.com/api/v1/calculate/wavelength-frequency?wavelength_m=5e-7
```

## Limitations

The wave travels in a dispersive medium (glass, water) unless you supply the correct phase speed, or you need Doppler shifts or refraction. All values are computed from the formula above; no measurement or live data is involved.

## FAQ

**Why is there no photon energy for my sound wave?**

Photon energy E = h·f applies to electromagnetic radiation only; it is reported when the wave speed equals c (vacuum). Sound is a mechanical wave.

**What speed should I use for light in glass or water?**

c divided by the refractive index (about 1.5 for glass, 1.33 for water); the frequency stays the same while the wavelength shortens.

## Related

- [Pendulum Period Calculator](https://tttkmbb.com/physics/pendulum.md) — Another periodic system: period and frequency of a pendulum.
- [Frequency Converter](https://tttkmbb.com/conversion/frequency.md) — Convert frequencies between Hz, kHz, MHz and GHz.
