byte[] data = Base64.decodeBase64(base64Img); try (OutputStream stream = new FileOutputStream("f:/java/test.txt")) { stream.write(data); }