πŸ› οΈToolsShed

Currency Converter

Convert between major world currencies using reference exchange rates.

⚠ Reference rates β€” not suitable for financial transactions.

Rates as of mid-2025 (USD base)

Currency Converter lets you convert amounts between world currencies using up-to-date exchange rates. Whether you are planning international travel, making a cross-border purchase, understanding a foreign salary, or managing a business with multi-currency revenue, this tool gives you a quick and accurate conversion.

Select the source and target currencies from the dropdowns, enter the amount, and the converted value is calculated immediately. Exchange rates are fetched from a reliable financial data source and updated regularly so the results reflect current market rates.

Keep in mind that the rates shown are mid-market rates (the midpoint between buy and sell rates). Banks, credit cards, and exchange bureaus typically add a margin or fee on top of the mid-market rate, so your actual cost when exchanging currency may be slightly higher.

Frequently Asked Questions

Code Implementation

def convert_currency(amount, from_rate_to_usd, to_rate_to_usd):
    """
    Convert amount between two currencies via USD as the base.
    Rates are expressed as 'units per 1 USD'.
    e.g. EUR/USD = 0.92 means from_rate_to_usd=1 (USD), to_rate_to_usd=0.92 (EUR)
    """
    amount_in_usd = amount / from_rate_to_usd
    return amount_in_usd * to_rate_to_usd

def build_rate_table(rates_vs_usd: dict, base="USD"):
    """
    Build a cross-rate table from rates expressed against USD.
    rates_vs_usd: {"EUR": 0.92, "GBP": 0.79, "JPY": 150.5, ...}
    """
    if base != "USD":
        base_rate = rates_vs_usd[base]
        rates_vs_usd = {k: v / base_rate for k, v in rates_vs_usd.items()}
        rates_vs_usd["USD"] = 1 / base_rate

    def get_rate(from_ccy, to_ccy):
        return rates_vs_usd[to_ccy] / rates_vs_usd.get(from_ccy, 1)

    return get_rate

# Example rates (illustrative, not live)
rates = {"USD": 1.0, "EUR": 0.92, "GBP": 0.79, "JPY": 150.5, "CAD": 1.36}

get_rate = build_rate_table(rates)

amount = 1000  # USD
for ccy in ["EUR", "GBP", "JPY", "CAD"]:
    converted = amount * get_rate("USD", ccy)
    print(f"${amount} USD = {converted:,.2f} {ccy}  (rate: {get_rate('USD', ccy):.4f})")

# Round-trip check
print(f"\nRound-trip: $1000 USD -> EUR -> USD = ${1000 * get_rate('USD', 'EUR') * get_rate('EUR', 'USD'):.4f}")

Comments & Feedback

Comments are powered by Giscus. Sign in with GitHub to leave a comment.