Обратно към блога

What is a Pip in Forex? A Developer's Guide to Pips, Pipettes, and FX Math (2026)

V
Vlado Grigirov
May 10, 2026
Currency API Exchange Rates Forex Education Developer Guide Pips Finexly

What is a Pip in Forex? A Developer's Guide to Pips, Pipettes, and FX Math (2026)

If you're building a trading bot, a position-size calculator, a risk dashboard, or any kind of FX-aware product, you'll hit the question fast: what is a pip in forex, and how do I calculate its value in code? Get this wrong and your P&L is off, your stop-losses fire at the wrong levels, and your users will not be patient about it.

This guide explains pips, pipettes, and the full pip-value formula from a developer's perspective — with worked examples and copy-pasteable code in JavaScript, Python, PHP, and cURL. By the end, you'll have a working pip calculator that pulls real-time rates from the Finexly API documentation and handles every edge case the textbooks gloss over.

What Is a Pip? The Quick Definition

A pip (short for "percentage in point" or "price interest point") is the smallest standardized price increment for a currency pair. For most pairs, that's the fourth decimal place of the quote — a movement of 0.0001. For pairs quoted in Japanese yen, it's the second decimal place — a movement of 0.01.

Concrete examples:

  • EUR/USD moves from 1.0850 to 1.08511 pip (0.0001 change in USD per EUR).
  • GBP/USD moves from 1.2640 to 1.265515 pips.
  • USD/JPY moves from 154.20 to 154.3010 pips (0.10 change in JPY per USD).
  • AUD/JPY moves from 99.45 to 99.40−5 pips.

The pip is the FX market's universal unit for "how much did the price move?" — far more useful than raw decimals because it normalizes the conversation across pairs that have very different absolute price levels.

Pips vs Pipettes vs Points

Modern brokers and data providers quote rates one decimal place beyond the standard pip. That extra digit is called a pipette, a fractional pip, or simply a point. One pipette equals one tenth of a pip.

PairPip sizePipette sizeExample quote
EUR/USD0.00010.000011.08507
GBP/USD0.00010.000011.26482
USD/JPY0.010.001154.215
EUR/JPY0.010.001167.482
When a broker shows EUR/USD as 1.08507, the trailing 7 is the pipette — usually rendered smaller or in superscript on a trading platform. As a developer, treat this distinction carefully: if you compute price differences using string arithmetic on quotes that include pipettes, you'll under-report pip moves by a factor of 10 unless you scale correctly.

A safe rule: always normalize to a numeric type, then multiply or divide by the pip size constant for that pair.

Why Pip Sizes Differ Across Currency Pairs

The two-decimal pip for JPY pairs is not an arbitrary choice. The Japanese yen has a small unit value relative to most reserve currencies — around 1 USD ≈ 154 JPY in 2026 — so quoting it to four decimals would create cosmetically tiny price moves and unreadable ladders on trading screens. Truncating to two decimals keeps the price action visually proportionate to other major pairs.

The same logic applies to a handful of other "low-unit-value" quote currencies (Korean won, Hungarian forint, etc.) — they're often quoted with pip sizes of 0.01 or 1. When you build a multi-pair system, never hardcode 0.0001 as your pip size constant. Always look it up per pair.

A pragmatic detection rule that works for the majority of pairs:

function getPipSize(pair) {
  // pair example: "EURUSD" or "EUR/USD"
  const quote = pair.replace("/", "").slice(3, 6).toUpperCase();
  const twoDecimalQuotes = new Set(["JPY", "HUF", "KRW"]);
  return twoDecimalQuotes.has(quote) ? 0.01 : 0.0001;
}

console.log(getPipSize("EURUSD")); // 0.0001
console.log(getPipSize("USD/JPY")); // 0.01
console.log(getPipSize("EURHUF")); // 0.01

For a production system you'll want a complete table of pip sizes keyed on ISO 4217 currency codes — see our ISO 4217 currency codes complete developer guide for the full list.

The Pip Value Formula

The core question for any P&L calculation: for a position of N units of the base currency, how much does my account balance change when the pair moves by one pip?

The general formula:

pip_value_in_quote_currency = pip_size × position_size
pip_value_in_account_currency = pip_value_in_quote_currency × (quote_to_account_rate)

Three cases, depending on how your account currency relates to the pair you're trading.

Case 1: Account Currency = Quote Currency

The simplest case. If you trade EUR/USD on a USD account, every pip is worth a fixed dollar amount with no further conversion needed.

pip_value = pip_size × position_size

For 100,000 units (one standard lot) of EUR/USD on a USD account:

0.0001 × 100,000 = 10 USD per pip

This is the textbook "$10 per pip per standard lot" you'll hear quoted everywhere — it only holds when the quote currency matches the account currency.

Case 2: Account Currency = Base Currency

If you trade USD/CHF on a USD account, the pip move is denominated in CHF and must be converted back to USD using the current ask rate of the pair.

pip_value_in_quote = pip_size × position_size
pip_value_in_account = pip_value_in_quote / current_rate

For 100,000 units of USD/CHF when USD/CHF = 0.9050:

0.0001 × 100,000 = 10 CHF
10 CHF / 0.9050 = 11.05 USD per pip

Case 3: Cross Pair (Neither Side is the Account Currency)

The trickiest case. You trade EUR/JPY on a USD account. The pip move is in JPY, and to express it in USD you need a conversion rate between JPY and USD.

pip_value_in_quote = pip_size × position_size
pip_value_in_account = pip_value_in_quote × (account_per_quote_rate)

For 100,000 units of EUR/JPY when USD/JPY = 154.20:

0.01 × 100,000 = 1,000 JPY
1,000 JPY / 154.20 = 6.49 USD per pip

Notice we used the USD/JPY rate, not the EUR/JPY rate, because we're converting from JPY to USD, not from EUR to anything.

Building a Pip Calculator with the Finexly API

Let's wire the formula above to a real, live exchange rate API so the calculator stays accurate as the market moves. Sign up at Finexly for a free API key — 1,000 requests/month with no card required, plenty for a calculator like this. The full request reference is in the Finexly API documentation.

JavaScript (Node.js)

const FINEXLY_API_KEY = process.env.FINEXLY_API_KEY;
const BASE_URL = "https://finexly.com/api";

// Two-decimal-pip currencies. Extend as needed.
const TWO_DECIMAL_PIP_QUOTES = new Set(["JPY", "HUF", "KRW"]);

function pipSize(quoteCcy) {
  return TWO_DECIMAL_PIP_QUOTES.has(quoteCcy) ? 0.01 : 0.0001;
}

async function getRate(base, quote) {
  const res = await fetch(
    `${BASE_URL}/latest?base=${base}&symbols=${quote}&api_key=${FINEXLY_API_KEY}`
  );
  const json = await res.json();
  return json.rates[quote];
}

async function calcPipValue({ pair, positionSize, accountCcy }) {
  const base = pair.slice(0, 3).toUpperCase();
  const quote = pair.slice(3, 6).toUpperCase();
  const pip = pipSize(quote);
  const pipValueInQuote = pip * positionSize;

  if (accountCcy === quote) {
    return pipValueInQuote;
  }
  if (accountCcy === base) {
    const rate = await getRate(base, quote);
    return pipValueInQuote / rate;
  }
  // Cross: convert quote -> account via account/quote rate
  const rate = await getRate(accountCcy, quote);
  return pipValueInQuote / rate;
}

// Example: 100,000 units of EUR/JPY on a USD account
calcPipValue({
  pair: "EURJPY",
  positionSize: 100_000,
  accountCcy: "USD",
}).then((v) => console.log(`Pip value: ${v.toFixed(2)} USD`));

Python

import os
import requests

FINEXLY_API_KEY = os.environ["FINEXLY_API_KEY"]
BASE_URL = "https://finexly.com/api"
TWO_DECIMAL_PIP_QUOTES = {"JPY", "HUF", "KRW"}

def pip_size(quote_ccy: str) -> float:
    return 0.01 if quote_ccy in TWO_DECIMAL_PIP_QUOTES else 0.0001

def get_rate(base: str, quote: str) -> float:
    r = requests.get(
        f"{BASE_URL}/latest",
        params={"base": base, "symbols": quote, "api_key": FINEXLY_API_KEY},
        timeout=10,
    )
    r.raise_for_status()
    return r.json()["rates"][quote]

def calc_pip_value(pair: str, position_size: float, account_ccy: str) -> float:
    base, quote = pair[:3].upper(), pair[3:6].upper()
    pip = pip_size(quote)
    pip_in_quote = pip * position_size

    if account_ccy == quote:
        return pip_in_quote
    if account_ccy == base:
        return pip_in_quote / get_rate(base, quote)
    # Cross
    return pip_in_quote / get_rate(account_ccy, quote)

if __name__ == "__main__":
    value = calc_pip_value("EURJPY", 100_000, "USD")
    print(f"Pip value: {value:.2f} USD")

PHP

<?php
$apiKey = getenv('FINEXLY_API_KEY');
$baseUrl = 'https://finexly.com/api';
$twoDecimalPipQuotes = ['JPY', 'HUF', 'KRW'];

function pipSize(string $quoteCcy): float {
    global $twoDecimalPipQuotes;
    return in_array($quoteCcy, $twoDecimalPipQuotes, true) ? 0.01 : 0.0001;
}

function getRate(string $base, string $quote): float {
    global $apiKey, $baseUrl;
    $url = "$baseUrl/latest?base=$base&symbols=$quote&api_key=$apiKey";
    $body = file_get_contents($url);
    $data = json_decode($body, true);
    return $data['rates'][$quote];
}

function calcPipValue(string $pair, float $positionSize, string $accountCcy): float {
    $base = strtoupper(substr($pair, 0, 3));
    $quote = strtoupper(substr($pair, 3, 3));
    $pipInQuote = pipSize($quote) * $positionSize;

    if ($accountCcy === $quote) return $pipInQuote;
    if ($accountCcy === $base)  return $pipInQuote / getRate($base, $quote);
    return $pipInQuote / getRate($accountCcy, $quote);
}

echo number_format(calcPipValue('EURJPY', 100000, 'USD'), 2) . " USD\n";

cURL

If you just need the raw rate to plug into your own pip calculation:

curl "https://finexly.com/api/latest?base=USD&symbols=JPY&api_key=YOUR_KEY"
# {"base":"USD","rates":{"JPY":154.20},"timestamp":1746...}

That single rate is enough to convert a JPY pip move into USD using the formula above.

Common Pip Math Pitfalls Developers Make

Pips look simple. The bugs are subtle. Five things to watch for:

1. Floating-point drift on pip arithmetic. 0.1 + 0.2 !== 0.3 in JavaScript, and the same family of issues bites you when summing pip P&L over many trades. For anything reaching production — especially financial calculations — use integer pip counts internally (multiply prices by 10_000 for non-JPY pairs and 100 for JPY pairs) or a decimal library like decimal.js or Python's decimal.Decimal.

2. Hardcoding 0.0001 as the pip size. This breaks every JPY pair the moment a user trades one. Always look up the pip size from a per-pair table.

3. Confusing pips with pipettes when comparing prices. A 5-decimal EUR/USD quote like 1.08502 looks like 1.08502 pips of movement from 1.08501, but it's only 1 pipette = 0.1 pips. Normalize to floats and divide by the pip size.

4. Using stale rates for the account-currency conversion in Case 3. A pip-value calculation for an open position should use the current rate, not the rate at the time the position was opened. If you cache rates, set TTLs short enough that the conversion stays accurate — see currency API caching & error handling best practices for production-tested patterns.

5. Forgetting bid/ask asymmetry. Brokers convert P&L using bid for closing longs and ask for closing shorts. For an end-user-facing calculator that only needs an estimate, a mid rate is fine. For an execution system, use the appropriate side.

For a deeper look at the bid/ask split, see our writeup on spot rate vs forward rate, and for cross-pair conversions see cross exchange rates explained.

Pip Value at a Glance: Common Pairs

For a USD-denominated account trading one standard lot (100,000 units), here are typical pip values at indicative May 2026 rates. Treat these as a sanity check, not as gospel — pull live rates from the Finexly currency converter or the API for anything that hits a real account.

PairPip sizePip value (1 lot, USD account)
EUR/USD0.000110.00 USD
GBP/USD0.000110.00 USD
USD/CHF0.0001~11.05 USD
USD/JPY0.01~6.49 USD
EUR/JPY0.01~6.49 USD
AUD/USD0.000110.00 USD
EUR/GBP0.0001~12.61 USD
Two patterns are worth memorizing as a developer doing FX work: USD-quoted pairs are always exactly $10 per pip per standard lot, and JPY-quoted pairs hover around half that, drifting with USD/JPY.

Frequently Asked Questions

What is a pip in forex in simple terms? A pip is the smallest standardized move in a currency pair's price — typically the fourth decimal for most pairs (0.0001) and the second decimal for yen pairs (0.01). It's the FX market's universal unit for measuring price movement.

How do I calculate pip value in code? Multiply the pip size by the position size to get the pip value in the quote currency, then convert to your account currency using the current exchange rate. The three cases (quote = account, base = account, cross) are shown in the JavaScript, Python, and PHP examples above.

What's the difference between a pip and a pipette? A pipette is one tenth of a pip — the fractional digit that some brokers and data feeds add for tighter spreads. If a pip on EUR/USD is 0.0001, a pipette is 0.00001.

Why is one pip equal to about $10 on EUR/USD? Because a standard lot is 100,000 units and the pip size for non-JPY pairs is 0.0001. 100,000 × 0.0001 = 10 units of the quote currency. When the quote currency is USD, that's $10 directly.

Do I need a paid API to build a pip calculator? No. Finexly's free plan gives you 1,000 requests per month and covers 170+ currencies — enough for a personal pip calculator or a low-traffic side project. For higher volume, see our pricing plans.

Are pip sizes different on crypto pairs? Crypto pairs don't follow the standard FX pip convention. BTC/USD often quotes to 2 or 4 decimals depending on the venue, and "1 pip" is venue-defined. For pure crypto P&L, work in absolute price differences rather than pips.

Ready to Build It?

You now have the formula, three working code samples, and a list of the bugs that bite most people. The last piece is real-time rates that won't drift on you mid-calculation.

Get your free Finexly API key — no credit card required. Start with 1,000 free requests per month, 170+ currencies, sub-50 ms latency, and upgrade only when you need to. Your pip calculator deserves rates as accurate as the math behind it.

Vlado Grigirov

Senior Currency Markets Analyst & Financial Strategist

Vlado Grigirov is a senior currency markets analyst and financial strategist with over 14 years of experience in foreign exchange markets, cross-border finance, and currency risk management. He has wo...

View full profile →

Сподели статията