Question: I saw a Solidity smart contract where some variables were declared with the type `address` and some were declared with the type `address payable`. What are the differences between the two?

* Do they store the same data?
* How do you convert a value from one address type to the other type?

Answer: 
Yes, they store the same data, that is a valid ethereum address.

The difference is that the compiler (at compile time) when encounter an “address payable” is ready to allow (if required in the following code) that address to access primitives useful to manage ethers (namely call, transfer, send).

In that sense, after a declaration like:

```
address payable spender;

```

the compiler shall accept any

```
spender.send();
spender.transfer();               (1)
spender.call();

```

and generates the bytecode required to implement them.

On the other hand if the declaration is:

```
address spender;

```

the compiler shall generate error if any of the (1) is encountered.

After the compile time there is not difference between payable or not address. In particular they have the same size in memory and are not distinguishable.

In short it is a congruency tag, nothing more.

Understanding this, it is very simple to convert any **address payable** to **address** and viceversa using cast:

```
address payable spender = msg.sender;
address owner;
address payable newspender;

owner = address(spender);   // this is no more payable
newspender = address( uint160(owner) );    // this is again payable

```

> 
> As you can see to do the opposite (not payable to payable) it is required explicitly to use uint160 as intermediate casting
> 
> 
> 

**Added after 0.6.0 solidity update:**

> 
> now you have the possibility to directly cast any address to a payable address using the “payable” keyword:
> 
> 
> 

```
address payable spender = msg.sender;
address owner;
address payable newspender;

owner = address(spender);   // this is no more payable
newspender = payable(owner);    // this is again payable

```
I was confused about the payable address but after a lot of searching, I find the best use case of a payable address.
when you are working with a solidity smart contract then you use the payable function which receives ethers and stores it in your contract, not your personal address.
so if you want to directly send ethers from the contract to your address then you must need to make your address payable.

Example:

```
address payable contractDeployer;

function recieveEth()public payable{

require(msg.value>0, "amount should be greater then Zero");

// now you directly transfer msg.value to "contractDeployer" account by using builtin function "transfer"

payable(contractDeployer).transfer(msg.value);

}

```

I hope this answer will be useful for you guys.

Thanks