Ethereum addresses are 20 bytes, so you convert hex address to bytes and then pad it to 32 bytes from left.

web3.utils.padLeft(web3.utils.hexToBytes(yourAddressString), 32);
Answer from Ferit on Stack Overflow
Discussions

solidity - Convert bytes32 to address - Ethereum Stack Exchange
Stack Exchange network consists ... trusted online community for developers to learn, share their knowledge, and build their careers. Visit Stack Exchange ... Bring the best of human thought and AI automation together at your work. Explore Stack Internal ... Is there a simple way to convert a bytes32, e.g. 0xca35b7d915458ef540ade6068dfe2f44e8fa733c, to an address... More on ethereum.stackexchange.com
🌐 ethereum.stackexchange.com
June 10, 2018
contract development - How to convert an address to bytes in Solidity? - Ethereum Stack Exchange
Also, note that this will pad the bytes32 to the right. Normally, in Ethereum, we pad to the left. Just omit the << 96 to do that. ... This answer does not work today. It says cannot convert address type to uint. More on ethereum.stackexchange.com
🌐 ethereum.stackexchange.com
February 2, 2016
How to take symbol like USD as bytes32 in solidity?
help needed. mapping(bytes32 => address) tokenSymboltoAddress; 1. The function saves tokenAddress on the tokenSymbol key in a mapping. function addAddresses(bytes32 _name, address _tokenAddress ) { tokenSymboltoAddress[bytes32] = _tokenAddress; } 2. Returns the address added in the mapping ... More on forum.openzeppelin.com
🌐 forum.openzeppelin.com
1
0
June 24, 2021
Bytes32 to Address String
Hoping someone may be able to show me the code for going from a bytes32 back to a string address. The first function below creates the bytes 32 from the address, but I also need to do the opposite... go from bytes32 back to the address. Thanks in advance to anyone with skills that can help. ... More on forum.openzeppelin.com
🌐 forum.openzeppelin.com
0
0
June 17, 2022
🌐
The Hot Code
thehotcode.com › the hot code › solidity
Transform an address in a bytes32 or uint256 in Solidity | The Hot Code
April 30, 2023 - Changing those using Foundry allows you to test multiple cases and see where it can break. uint256(uint160(address)) bytes32(uint256(uint160(address))) Sometimes, you can send an address and store it into a variable that is not supposed to be that. With a proxy implementation, you can trigger unexpected behavior.
🌐
GitHub
github.com › ethers-io › ethers.js › discussions › 3561
convert bytes32 to address · ethers-io/ethers.js · Discussion #3561
November 29, 2022 - Describe the Feature In solidity, We can change bytes32 to address using address160(address265(bytes32_value)). I need to convert bytes32 to address in nodejs, and I couldn't find any method wi...
Author   ethers-io
🌐
Deth
tools.deth.net › string-bytes32-conversion
String Bytes32 Conversion
String Bytes32 Conversion · decoders · Calldata Decoder · Event Decoder · Tx Decoder · encoders · Constructor Encoder · generators · Vanity Address Generator
🌐
GitHub
gist.github.com › imentus-rahul › 0f37502c4c862a16e0c9150464105eda
address-to-bytes32 · GitHub
address-to-bytes32 · Raw · address-to-bytes32.js · This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below.
Find elsewhere
🌐
OpenZeppelin
forum.openzeppelin.com › support
How to take symbol like USD as bytes32 in solidity? - Support - OpenZeppelin Forum
June 24, 2021 - help needed. mapping(bytes32 => address) tokenSymboltoAddress; 1. The function saves tokenAddress on the tokenSymbol key in a mapping. function addAddresses(bytes32 _name, address _tokenAddress ) { tokenSymboltoAddress[bytes32] = _tokenAddress; ...
🌐
OpenZeppelin
forum.openzeppelin.com › smart contracts
Bytes32 to Address String - Smart Contracts - OpenZeppelin Forum
June 17, 2022 - Hoping someone may be able to show me the code for going from a bytes32 back to a string address. The first function below creates the bytes 32 from the address, but I also need to do the opposite... go from bytes32 back to the address. Thanks in advance to anyone with skills that can help. function hash(address _addr) external pure returns (bytes32) { return keccak256(abi.encodePacked(_addr)); }
🌐
Confluxnetwork
doc.confluxnetwork.org › core space basics › base32 addresses
Base32 Addresses | Conflux Documentation
If create2 is used, the deployed address of can be computed as the following code described: The Create2Factory has been deployed via CIP-31, so you can use the 0x8a3a92281df6497105513b18543fd3b60c778e40 contract or deploy your own Create2Factory. ... # using web3.py is also viable # from web3 import Web3 from conflux_web3 import Web3 # ensure salt is a bytes32 to ...
🌐
Solidity Forum
forum.soliditylang.org › feedback
Return bytes32 or address in one or two functions? - Feedback - Solidity Forum
June 9, 2022 - Hello everyone. I have a question in solidity regarding different methods concerned with returning an address that is either as it is, an (address) type or encrypted therefore resulting as (bytes32). If I can just crea…
🌐
Onbrn
web3-type-converter.onbrn.com
Web3 Type Converter - Convert from bytes32 to string
Convert from bytes32 to string, number to bytes32, and more!
🌐
Foundry
book.getfoundry.sh › reference › cast › cast-to-bytes32
foundry - Ethereum Development Framework
Foundry is a smart contract development toolchain. It manages your dependencies, compiles your project, runs tests, deploys, and lets you interact with the chain from the command-line and via Solidity scripts.
🌐
Etherscan
etherscan.io › contractdiffchecker
Ethereum Contract Diff Checker - Etherscan
The Ethereum BlockChain Explorer, API and Analytics Platform
🌐
Ethers
docs.ethers.org › v4 › api-utils.html
Utilities — ethers.js 4.0.0 documentation
let text = "Hello World!" let bytes32 = ethers.utils.formatBytes32String(text) // "0x48656c6c6f20576f726c64210000000000000000000000000000000000000000" let originalText = ethers.utils.parseBytes32String(bytes32) // "Hello World!" ... The BigNumber bigNumberify(-1). ... The BigNumber bigNumberify(0). ... The BigNumber bigNumberify(1). ... The BigNumber bigNumberify(2). ... The Greek character Xi, used as the symbol for ether. utils . computeAddress ( publicOrPrivateKey ) => Address