diff --git a/src/Data/Bits/ToolsYj.hs b/src/Data/Bits/ToolsYj.hs
--- a/src/Data/Bits/ToolsYj.hs
+++ b/src/Data/Bits/ToolsYj.hs
@@ -1,7 +1,8 @@
 {-# OPTIONS_GHC -Wall -fno-warn-tabs #-}
 
-module Data.Bits.ToolsYj (checkBits, bitsList) where
+module Data.Bits.ToolsYj (bitsToBits, checkBits, bitsList) where
 
+import Control.Arrow
 import Data.Bits
 
 checkBits :: Bits bs => bs -> bs -> Bool
@@ -10,3 +11,7 @@
 bitsList :: FiniteBits bs => bs -> [bs]
 bitsList bs =
 	filter (/= zeroBits) $ map ((bs .&.) . bit) [0 .. finiteBitSize bs - 1]
+
+bitsToBits :: (Bits a, Bits b) => Int -> a -> b
+bitsToBits n b = foldl setBit zeroBits
+	. map fst . filter snd $ map (id &&& testBit b) [0 .. n - 1]
diff --git a/src/Data/ByteString/ToolsYj.hs b/src/Data/ByteString/ToolsYj.hs
new file mode 100644
--- /dev/null
+++ b/src/Data/ByteString/ToolsYj.hs
@@ -0,0 +1,34 @@
+{-# LANGUAGE ImportQualifiedPost #-}
+{-# LANGUAGE BlockArguments, OverloadedStrings #-}
+{-# LANGUAGE ScopedTypeVariables, TypeApplications #-}
+{-# OPTIONS_GHC -Wall -fno-warn-tabs #-}
+
+module Data.ByteString.ToolsYj (
+
+	fromBits, fromBits', toBits, toBits'
+
+	) where
+
+import Data.Bits
+import Data.Bits.ToolsYj
+import Data.Bool
+import Data.ByteString qualified as BS
+
+fromBits :: Bits b => b -> BS.ByteString
+fromBits = BS.unfoldr \b ->
+	bool Nothing (Just (bitsToBits 8 b, b `shiftR` 8)) (b /= zeroBits)
+
+fromBits' :: FiniteBits b => b -> BS.ByteString
+fromBits' b0 = go (finiteBitSize b0 `div` 8) b0
+	where
+	go 0 _ = ""
+	go n b = bitsToBits 8 b `BS.cons` go (n - 1) (b `shiftR` 8)
+
+toBits :: Bits b => BS.ByteString -> b
+toBits = BS.foldr (\b s -> bitsToBits 8 b .|. s `shiftL` 8) zeroBits
+
+toBits' :: forall b . FiniteBits b => BS.ByteString -> Maybe b
+toBits' bs = bool
+	Nothing
+	(Just $ BS.foldr (\b s -> bitsToBits 8 b .|. s `shiftL` 8) zeroBits bs)
+	(8 * BS.length bs <= finiteBitSize @b undefined)
diff --git a/tools-yj.cabal b/tools-yj.cabal
--- a/tools-yj.cabal
+++ b/tools-yj.cabal
@@ -5,7 +5,7 @@
 -- see: https://github.com/sol/hpack
 
 name:           tools-yj
-version:        0.1.0.25
+version:        0.1.0.26
 synopsis:       Tribial tools
 description:    Please see the README on GitHub at <https://github.com/YoshikuniJujo/tools-yj#readme>
 category:       Tools
@@ -31,6 +31,7 @@
       Control.Monad.ToolsYj
       Data.Bits.ToolsYj
       Data.Bool.ToolsYj
+      Data.ByteString.ToolsYj
       Data.Either.ToolsYj
       Data.Function.ToolsYj
       Data.IORef.ToolsYj
@@ -50,6 +51,7 @@
   ghc-options: -Wall -Wcompat -Widentities -Wincomplete-record-updates -Wincomplete-uni-patterns -Wmissing-export-lists -Wmissing-home-modules -Wpartial-fields -Wredundant-constraints
   build-depends:
       base >=4.7 && <5
+    , bytestring <1
     , containers <1
     , data-default <1
     , mono-traversable <2
@@ -69,6 +71,7 @@
   ghc-options: -Wall -Wcompat -Widentities -Wincomplete-record-updates -Wincomplete-uni-patterns -Wmissing-export-lists -Wmissing-home-modules -Wpartial-fields -Wredundant-constraints -threaded -rtsopts -with-rtsopts=-N
   build-depends:
       base >=4.7 && <5
+    , bytestring <1
     , containers <1
     , data-default <1
     , mono-traversable <2
