Deshmaj Currency Converter Calculator
🌍 Deshmaj Currency Converter
// 🌍 currencies const currencies=[ "USD","EUR","GBP","JPY","AUD","CAD","CHF","CNY","HKD","NZD","SEK","NOK","DKK","SGD", "KRW","INR","PKR","BDT","LKR","AED","SAR","QAR","KWD","BHD","OMR","TRY","RUB","ZAR", "EGP","NGN","BRL","ARS","CLP","MXN","COP","PEN","VND","THB","MYR","IDR","PHP","ILS", "PLN","CZK","HUF","RON","BGN","MAD","TND","KES","TZS","UGX","GHS","ETB","UAH","IRR", "IQD","AFN","NPR","MMK","KHR","LAK","MNT","UZS","KZT","AZN","GEL","AMD","ISK" ];
function fill(){ let f=document.getElementById("from"); let t=document.getElementById("to");
currencies.forEach(c=>{ f.innerHTML+=`
f.value="USD"; t.value="PKR"; } fill();
function toggleRateBox(){ document.getElementById("rateArea").style.display = document.getElementById("useRate").checked ? "block":"none"; }
let lastOutput="";
// 🌐 LIVE + CUSTOM LOGIC async function convert(){ let amount=document.getElementById("amount").value; let from=document.getElementById("from").value; let to=document.getElementById("to").value; let useCustom=document.getElementById("useRate").checked;
if(amount===""){ showToast("Enter amount"); return; }
let rate; let mode;
if(useCustom){ rate=document.getElementById("rate").value; if(rate===""){ showToast("Enter custom rate"); return; } mode="Custom Rate"; }else{ try{ let res=await fetch(`https://open.er-api.com/v6/latest/${from}`); let data=await res.json(); rate=data.rates[to]; mode="Live Rate"; }catch(e){ showToast("API Error"); return; } }
let result=amount*rate;
lastOutput= `💱 DESHMAJ CURRENCY CONVERTER
Amount: ${amount} ${from} Rate: 1 ${from} = ${rate} ${to}
Final Result: ${result.toFixed(2)} ${to}
Mode: ${mode}
Calculation: ${amount} x ${rate} = ${result.toFixed(2)} ${to} `;
document.getElementById("output").innerText=lastOutput; }
// ✔ COPY FIXED function copyResult(){ if(!lastOutput){ showToast("No result to copy"); return; }
const ta=document.createElement("textarea"); ta.value=lastOutput; document.body.appendChild(ta); ta.select(); document.execCommand("copy"); document.body.removeChild(ta);
showToast("Copied successfully"); }
// ✔ DOWNLOAD TXT function downloadTXT(){ if(!lastOutput){ showToast("No result to download"); return; }
let blob=new Blob([lastOutput],{type:"text/plain"}); let a=document.createElement("a"); a.href=URL.createObjectURL(blob); a.download="Deshmaj-Currency-Result.txt"; a.click(); }
// toast function showToast(msg){ let t=document.getElementById("toast"); t.innerText=msg; t.className="show"; setTimeout(()=>t.className=t.className.replace("show",""),1800); }
🌍 User Guide
The Deshmaj Currency Converter is a modern, fast, and highly reliable web-based currency conversion tool designed to help users convert any currency in the world within seconds. It supports both live exchange rates and custom user-defined rates, making it suitable for students, freelancers, travelers, and business professionals.
This detailed guide explains everything about the tool in a simple, human-friendly way so you can fully understand how to use it, how it works behind the scenes, and how to get the most accurate results.
🌟 Overview of the Deshmaj Currency Converter
The tool is built to remove confusion from currency conversion. Instead of manually searching exchange rates or using complicated apps, this converter provides everything in one clean interface.
It offers:
- Instant currency conversion
- Live exchange rate API integration
- Custom rate input option
- More than 65 international currencies
- Simple and clean UI design
- Copy result feature
- Download result as TXT file
- Real-time validation messages
🧩 Understanding the User Interface
Before using the tool, it is important to understand each section of the interface.
1. Amount Input Field
This is the first field you will see in the converter. Here you enter the amount you want to convert.
For example:
- 100 USD
- 500 EUR
- 1000 PKR
If you leave this field empty and try to convert, the tool will show a message asking you to enter an amount first.
2. From Currency Selector
This dropdown allows you to select the currency you currently have.
Examples include:
- USD – United States Dollar
- EUR – Euro
- GBP – British Pound
- PKR – Pakistani Rupee
- INR – Indian Rupee
By default, the tool sets this value to USD.
3. To Currency Selector
This dropdown lets you choose the currency you want to convert into.
For example:
- USD → PKR
- EUR → USD
- GBP → AED
The default value is usually PKR.
4. Custom Rate Option (Important Feature)
One of the most powerful features of this converter is the Custom Rate Mode.
When you enable the checkbox:
“Do you want to use Custom Rate?”
A new input field appears where you can manually enter your exchange rate.
Example:
1 USD = 280 PKR
You only need to enter: 280
This is very useful for traders, freelancers, or cases where live rates are not required.
🔄 How the Conversion Process Works
When you click the Convert button, the system follows a structured process to ensure accuracy.
Step 1: Input Validation
The tool first checks:
- If the amount is entered
- If custom rate is enabled, whether rate is filled
If anything is missing, a toast notification appears instantly.
Step 2: Rate Selection
The tool then decides which rate to use:
- Live Mode: Fetches real-time exchange rates from an online API
- Custom Mode: Uses the user-defined rate
If the API fails, the tool shows an “API Error” message.
Step 3: Calculation Formula
The conversion uses a simple formula:
Final Result = Amount × Exchange Rate
Example:
100 × 280 = 28000 PKR
Step 4: Result Display
After calculation, the tool generates a clean and formatted result including:
- Entered amount
- Selected currencies
- Exchange rate used
- Final converted value
- Calculation breakdown
- Mode (Live or Custom)
📋 Copy Result Feature
The Copy button allows users to instantly copy the full result text.
This is very useful for:
- Sharing results
- Saving calculations
- Client work (freelancers)
If no result is available, the tool will notify:
No result to copy
📥 Download Result Feature
Users can also download the result as a text file for offline use.
File name:
Deshmaj-Currency-Result.txt
This feature is helpful for record keeping, reporting, or business documentation.
🔔 Toast Notification System
The tool uses modern toast notifications that appear at the bottom of the screen. These notifications are used for:
- Missing input warnings
- Successful copy message
- Download confirmation
- API errors
They automatically disappear after a short time, making the interface clean and user-friendly.
🧠 Behind the Technology (How It Works Internally)
The converter uses JavaScript and a live exchange rate API:
https://open.er-api.com/v6/latest/[CURRENCY]
Main functions include:
- fill() → loads all currencies
- convert() → handles conversion logic
- toggleRateBox() → shows custom rate field
- copyResult() → copies output
- downloadTXT() → generates file
🌍 Who Should Use This Tool?
This converter is perfect for:
- Students learning finance
- Freelancers working with international clients
- Travelers checking exchange rates
- Online business owners
- Forex traders (basic use)
🏁 Final Conclusion
The Deshmaj Currency Converter is a complete financial utility tool that combines simplicity with powerful features. It is fast, accurate, and easy to use for everyone.
With support for both live and custom rates, along with copying and downloading features, it becomes a complete solution for daily currency conversion needs.
✔ Fast | ✔ Accurate | ✔ Easy to Use | ✔ Professional Tool






Leave a Reply