© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
C#C
C#•4y ago
Danielcik

Weird ToBase64String behavior

I have an mp3 file, which is perfectly normal, and plays fine.

I use this code to convert it to a base64 string:

 Byte[] bytes = await File.ReadAllBytesAsync("video.mp3");
        String file = Convert.ToBase64String(bytes);
 Byte[] bytes = await File.ReadAllBytesAsync("video.mp3");
        String file = Convert.ToBase64String(bytes);


When I try to play it as an audio in JS, it only plays 3 seconds, and then skips to the end.
I also tried to use https://base64.guru/converter/decode/file to see if it will be different, I paste the base64 string, but it isn't, it plays 3 seconds, then stops.

What am I doing wrong?
Base64 to File | Base64 Decode | Base64 Converter | Base64
Decode Base64 to file online using a free decoding tool
C# banner
C#Join
We are a programming server aimed at coders discussing everything related to C# (CSharp) and .NET.
61,871Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

✅ Weird ASP0016 behavior
C#CC# / help
4mo ago
✅ powershell post MultipartContent weird behavior
C#CC# / help
4y ago
❔ Convert.ToBase64String(array, Base64FormattingOptions.InsertLineBreaks);
C#CC# / help
4y ago
✅ Caesar Cipher Code with Weird Behavior
C#CC# / help
3y ago