This thesis describes the design and implementation of a star tracker for CubeSats. The author designed hardware modules for real-time star detection and centroid calculation using an FPGA. An image sensor and lens were selected, and a baffle was designed. Noise correction algorithms were developed. Testing showed the star tracker could detect stars up to magnitude 4.0 with sub-pixel centroiding accuracy of 0.0536 degrees. Future work includes integrating modules into an FPGA, implementing star identification and attitude algorithms, and testing the complete system.