Bitcoin Forum
August 27, 2026, 06:50:51 AM *
News: Latest Bitcoin Core release: 31.1 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: How does a Bitcoin wallet decide which UTXOs to spend?  (Read 111 times)
standardnepo (OP)
Jr. Member
*
Offline

Activity: 58
Merit: 23


View Profile
August 26, 2026, 09:14:06 PM
 #1

I’m learning about outputs, inputs, UTXOs etc. Let’s say I have multiple UTXOs from different transactions. For example I have:

UTXO1 = 0.10 BTC
UTXO2 = 0.15 BTC
UTXO3 = 0.30 BTC

and I want to send 0.25 BTC to someone. Does my wallet always choose the UTXOs that are closest to the amount I want to send?
I mean how does a wallet decide which UTXOs should be spent? I’m trying to understand the logic behind UTXO selection.
Chibit01
Full Member
***
Offline

Activity: 462
Merit: 155


Prioritize Privacy


View Profile
August 26, 2026, 09:19:28 PM
 #2


It depends on the wallet software you are using and how the developer programs it. The example which you gave them it is possible that you will be spending the UTXO3 since it has enough to cover the sending balance. You don't need to pick which one is closest to the other. Fees and privacy should be put first while making that transaction decision, that's how i view it, especially if one is using wallets like electrum and blue wallet which I consider them as wallets which promotes privacy.
hmbdofficial
Full Member
***
Offline

Activity: 294
Merit: 108

Creating a Safer Crypto Ecosystem


View Profile
August 26, 2026, 09:30:20 PM
 #3

It depends on the wallet software you are using and how developer programs it, the example which you gave their is possible that you will be spending the UTXO3 since it have enough to cover the sending balance, it dont need to pick which one is closest to the other, fee and privacy should be put first while making that transaction decision.

No it’s doesn’t depend on wallet software actually, it’s just wallet- side algorithms. What the wallet does in UTXO selection is that they try to avoid UTXO’s that will give so many inputs for the transaction so it select the UTXO that should give less input based on the transaction you initiated and also avoiding UTXO that will give excessive chance considering if there is going to be change if the UTXO are not spent completely in the transaction.
Cookdata
Legendary
*
Online Online

Activity: 1778
Merit: 1471


Not Your Keys, Not Your Bitcoin


View Profile
August 26, 2026, 09:32:31 PM
Merited by Mia Chloe (2)
 #4

I’m learning about outputs, inputs, UTXOs etc. Let’s say I have multiple UTXOs from different transactions. For example I have:

UTXO1 = 0.10 BTC
UTXO2 = 0.15 BTC
UTXO3 = 0.30 BTC

and I want to send 0.25 BTC to someone. Does my wallet always choose the UTXOs that are closest to the amount I want to send?
I mean how does a wallet decide which UTXOs should be spent? I’m trying to understand the logic behind UTXO selection.

If you have wallet balance with many utxo, you should get a Wallet that has a coin control feature, it will help you identify which of the input to spend in a transaction.
Since you are spending 0.25, with coin control you can select utxo3, 0.35 BTC will be used as your input, the output will be two, first one will be 0.25 BTC and the change 0.099 BTC while the remain will be transaction fee.

Remember, input - output = fee

You can't use utxo 1 and 2, the two combine as input will be 0.25, you wouldn't be able to pay the transaction fee which is impossible.

If you use a wallet that does not have coin control, the wallet will help you combine the utxos that is bigger than your inputs plus your fee.

Upgrade00
Legendary
*
Offline

Activity: 2856
Merit: 2937


Community Manager - Brand Promotions ✅


View Profile WWW
August 26, 2026, 09:36:59 PM
 #5

I have not noticed any pattern to it, it sometimes takes from a single one that covers it or multiple ones even if a single one could. When I'm looking to save on fees I use coin control to use just a single utxo.

If the wallet by default spends from all 3 it will help with consolidation which saves on fees in the future. The balance from all 3 utxos will all be sent back to a single change address, so when next you're making a transaction fees will be cheaper.

███████████████████████████
███████▄████████████▄██████
████████▄████████▄████████
███▀█████▀▄███▄▀█████▀███
█████▀█▀▄██▀▀▀██▄▀█▀█████
███████▄███████████▄███████
███████████████████████████
███████▀███████████▀███████
████▄██▄▀██▄▄▄██▀▄██▄████
████▄████▄▀███▀▄████▄████
██▄███▀▀█▀██████▀█▀███▄███
██▀█▀████████████████▀█▀███
███████████████████████████
.
.Duelbits..REWARDING, BEYOND LIMITS...
█████████████████████████
█████████████████████████
███████████▀▀░░▀█▄░░▀████
████████▀░░░░░░░░▀█▄░████
███████░░░░▄▄░░▄░░░▀█████
██████░░░░░▀▀▄██▀░░░░████
█████░░░██░▄██▀▄▄░░░█████
████░░░░░▄██▀░░▀▀░░██████
█████▄░░▀█▀░██░░░░███████
████░▀█▄░░░░░░░░▄████████
████▄░░▀█▄░░▄▄███████████
█████████████████████████
█████████████████████████
█████████████████████████
█████████████████████████
█████████▀░░▀░███████████
████████░░░▄░█░██████████
███████████▌▐██░█████████
███████████░███▌▐████████
██████████░█████░████████
██████▀░▄░▀███▀░▄░▀█████
█████░▄▀░░░░█░▄▀░░░░█████
█████░░░░░░░█░░░░░░░█████
██████▄░░░▄███▄░░░▄██████
█████████████████████████
█████████████████████████


























  PLAY NOW  
Mia Chloe
Legendary
*
Offline

Activity: 1176
Merit: 2284


Contact me for your designs...


View Profile
August 26, 2026, 09:52:56 PM
 #6

and I want to send 0.25 BTC to someone. Does my wallet always choose the UTXOs that are closest to the amount I want to send?
I mean how does a wallet decide which UTXOs should be spent? I’m trying to understand the logic behind UTXO selection.
In most cases the wallet softwares a programmed to target the utxo with the highest paying capability so you don't consolidate too much and at the end of the day you end up with leftover amount that could be spread across your change addresses. So yeah it's gonna pick 0.3 BTC by default.

The idea is if I picked the smaller utxo I would have to pay more in fees because of consolidation of both utxo to pay for the transaction and still create a change address.

coinlary
Sr. Member
****
Offline

Activity: 756
Merit: 282


Make decisions without looking back


View Profile
August 26, 2026, 10:14:02 PM
 #7

It depends.

If those UTXO are on separate address  then it's probably going to spend two or the one that can handle the entire txn all at once but if you have all UTXO in a single address, all will likely be spent and the change will be sent to a change address.

There are some wallet that automatically handles how you spend your UTXOs while some allows you to manually select which UTXO(s) you will like to spend or combine for spending (e.g Electrum).

It depends on the wallet software you are using and how developer programs it,

No it’s doesn’t depend on wallet software actually, it’s just wallet- side algorithms.
So how Is it not different? Devs can choose to use whatever algorithm they want for a wallet  , it's not like there's a specific algorithm they all use.

I can decide to build wallet software that uses every available UTXO even when it's not needed while I can also decide to build another software that reuses just a single address so I can handle the UTXO(s) however I want.

There're different ways to kill a rat.

standardnepo (OP)
Jr. Member
*
Offline

Activity: 58
Merit: 23


View Profile
August 26, 2026, 10:25:31 PM
 #8

Thanks everyone!

If you have wallet balance with many utxo, you should get a Wallet that has a coin control feature, it will help you identify which of the input to spend in a transaction.
Since you are spending 0.25, with coin control you can select utxo3, 0.35 BTC will be used as your input, the output will be two, first one will be 0.25 BTC and the change 0.099 BTC while the remain will be transaction fee.

Remember, input - output = fee

You can't use utxo 1 and 2, the two combine as input will be 0.25, you wouldn't be able to pay the transaction fee which is impossible.

If you use a wallet that does not have coin control, the wallet will help you combine the utxos that is bigger than your inputs plus your fee.
I had no idea coin control was a thing. Really appreciate the detailed answer.
Cookdata
Legendary
*
Online Online

Activity: 1778
Merit: 1471


Not Your Keys, Not Your Bitcoin


View Profile
August 26, 2026, 10:37:27 PM
Last edit: August 26, 2026, 10:57:58 PM by Cookdata
Merited by standardnepo (1)
 #9

Thanks everyone!

If you have wallet balance with many utxo, you should get a Wallet that has a coin control feature, it will help you identify which of the input to spend in a transaction.
Since you are spending 0.25, with coin control you can select utxo3, 0.35 BTC will be used as your input, the output will be two, first one will be 0.25 BTC and the change 0.099 BTC while the remain will be transaction fee.

Remember, input - output = fee

You can't use utxo 1 and 2, the two combine as input will be 0.25, you wouldn't be able to pay the transaction fee which is impossible.

If you use a wallet that does not have coin control, the wallet will help you combine the utxos that is bigger than your inputs plus your fee.
I had no idea coin control was a thing. Really appreciate the detailed answer.

It's a cool feature, you should try it, not just for spending certain utxo, it helps you to consolidate inputs to another address to become a single inputs when transaction fee is low. Spending plenty of utxo together increase your transaction size which you have to pay for every bytes in the transaction but when you so consolidate them to a single output, that way even when the fee is high anytime you want to spend your Bitcoin, you don't have to worry about the transaction size and the fee. Aside from that, it helps you protect your privacy, it helps you avoid some inputs like dusts transactions if you have any on your wallet address.

Some of the open source mobile wallet with coin control I can recommend are Electrum wallet(it's only available for android) and Blue wallet for only Bitcoin wallet. Multichain wallet like Cake wallet also has coin control. Pc wallets like Electrum and Sparrow supports coin control but I will recommend electrum, it's more lighter and simple to use.

KingsDen
Legendary
*
Offline

Activity: 1932
Merit: 1325


Goodnight, o_e_l_e_o & 1miau 🌹


View Profile WWW
August 26, 2026, 11:59:14 PM
 #10

I’m learning about outputs, inputs, UTXOs etc. Let’s say I have multiple UTXOs from different transactions. For example I have:

UTXO1 = 0.10 BTC
UTXO2 = 0.15 BTC
UTXO3 = 0.30 BTC

and I want to send 0.25 BTC to someone. Does my wallet always choose the UTXOs that are closest to the amount I want to send?
I mean how does a wallet decide which UTXOs should be spent? I’m trying to understand the logic behind UTXO selection.
This is why I said learning and using bitcoin has become easy. When I was new here, I learnt many things, even if I don't use them, I still understand them. But some new people can decide not to learn about them and still be very fine because things are quite simple now.

Your wallet does not choose UTXOs that are closest to the amount you want to send just like that; every wallet has what is called "Coin selection strategy". Used to balance speed, fees and even privacy.

Somes strategies are;
  • FIFO - First - In - First - Out; - just as the name implies this spends old UTXOs first
  • HIFO - Highest - In - First - Out; - Here, the largest UTXOs are spent first. From your example above, 0.30 BTC will leave first, and this strategy helps the transaction fee.
  • Branch and Bond (BnB); - This finds UTXOs that matches the exact transaction amount plus fees.
There are other strategies, such as the one used by blue wallet to consolidate tiny UTXOs, it can be called Dust mitigation strategy.

But as mentioned above, our smart wallets do these works for us, they chose the most appropriate strategy for every transaction especially for the sake of the fees.

R


▀▀▀▀▀▀▀██████▄▄
████████████████
▀▀▀▀█████▀▀▀█████
████████▌███▐████
▄▄▄▄█████▄▄▄█████
████████████████
▄▄▄▄▄▄▄██████▀▀
LLBIT|
4,000+ GAMES
███████████████████
██████████▀▄▀▀▀████
████████▀▄▀██░░░███
██████▀▄███▄▀█▄▄▄██
███▀▀▀▀▀▀█▀▀▀▀▀▀███
██░░░░░░░░█░░░░░░██
██▄░░░░░░░█░░░░░▄██
███▄░░░░▄█▄▄▄▄▄████
▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
█████████
▀████████
░░▀██████
░░░░▀████
░░░░░░███
▄░░░░░███
▀█▄▄▄████
░░▀▀█████
▀▀▀▀▀▀▀▀▀
█████████
░░░▀▀████
██▄▄▀░███
█░░█▄░░██
░████▀▀██
█░░█▀░░██
██▀▀▄░███
░░░▄▄████
▀▀▀▀▀▀▀▀▀
||.
|
▄▄████▄▄
▀█▀
▄▀▀▄▀█▀
▄░░▄█░██░█▄░░▄
█░▄█░▀█▄▄█▀░█▄░█
▀▄░███▄▄▄▄███░▄▀
▀▀█░░░▄▄▄▄░░░█▀▀
░░██████░░█
█░░░░▀▀░░░░█
▀▄▀▄▀▄▀▄▀▄
▄░█████▀▀█████░▄
▄███████░██░███████▄
▀▀██████▄▄██████▀▀
▀▀████████▀▀
.
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
░▀▄░▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄░▄▀
███▀▄▀█████████████████▀▄▀
█████▀▄░▄▄▄▄▄███░▄▄▄▄▄▄▀
███████▀▄▀██████░█▄▄▄▄▄▄▄▄
█████████▀▄▄░███▄▄▄▄▄▄░▄▀
███████████░███████▀▄▀
███████████░██▀▄▄▄▄▀
███████████░▀▄▀
████████████▄▀
███████████
▄▄███████▄▄
▄████▀▀▀▀▀▀▀████▄
▄███▀▄▄███████▄▄▀███▄
▄██▀▄█▀▀▀█████▀▀▀█▄▀██▄
▄██▀▄███░░░▀████░███▄▀██▄
███░████░░░░░▀██░████░███
███░████░█▄░░░░▀░████░███
███░████░███▄░░░░████░███
▀██▄▀███░█████▄░░███▀▄██▀
▀██▄▀█▄▄▄██████▄██▀▄██▀
▀███▄▀▀███████▀▀▄███▀
▀████▄▄▄▄▄▄▄████▀
▀▀███████▀▀
OFFICIAL PARTNERSHIP
SOUTHAMPTON FC
FAZE CLAN
SSC NAPOLI
[/quote]
Code:
[center][table][tr][td][url=h
hd49728
Legendary
*
Offline

Activity: 2926
Merit: 1376



View Profile
Today at 01:51:01 AM
 #11

I’m learning about outputs, inputs, UTXOs etc. Let’s say I have multiple UTXOs from different transactions. For example I have:

UTXO1 = 0.10 BTC
UTXO2 = 0.15 BTC
UTXO3 = 0.30 BTC

and I want to send 0.25 BTC to someone. Does my wallet always choose the UTXOs that are closest to the amount I want to send?
I mean how does a wallet decide which UTXOs should be spent? I’m trying to understand the logic behind UTXO selection.
Honestly, I don't know about priority of UTXOs selection automatically by wallet softwares but for privacy, the advice is using coin control feature and decide which UTXOs you want to use together with change addresses.

I guess it will choose the UTXO3 because it results in a smaller size with only 1 input, 2 outputs. Combinations of UTXO1 & UTXO2

There is coin control feature to use for choosing and controlling UTXOs in your wallets for transactions, both sending bitcoin to another address, someone else and for consolidation purpose too. Generally, same number of inputs have bigger sizes than same number of outputs.

Unspent Transaction Outputs UTXOs.
Consolidate your small inputs.
How to spend specific UTXOs in Electrum wallet.
Sending Bitcoin from specific address in core & electrum wallet – Coin control.
UTXO Management and Coin Control for Maximum Privacy.

Zaguru12
Legendary
*
Offline

Activity: 1526
Merit: 1270


Instant Crypto Withdrawals


View Profile WWW
Today at 05:42:38 AM
 #12

Honestly, I don't know about priority of UTXOs selection automatically by wallet softwares but for privacy, the advice is using coin control feature and decide which UTXOs you want to use together with change addresses.

The priority is heavily dependent on what exactly the wallet themselves want, for bitcoin core it uses the two know algorithm which is the Branch and Bond, and Coin Grinder, both of these has their priorities; the branch and bond focuses on trying to avoid waste by trying to merge the best possible sets together so that change can be avoided, while Coin Grinder is similar to the branch and Bond it differs by not trying to avoid creating change but rather by trying to find input sets with the most minimum total weight, this size of inputs helps to minimize the fee.

You can look at this to understand how coin control works on Bitcoin core
github.com/bitcoin/bitcoin/blob/29.x/src/wallet/coinselection.cpp

As for electrum it prioritizes your privacy

Coin control is a thing in between find the minimum fee and trying to protect your privacy at most or avoiding two many change which can be a future problem so the wallets are always updating their algorithm. For the period of time the best way is to actually do it your self if you’re using SPV wallets like electrum

Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!